Uninitialized constant XmlEngine::Logger (NameError)

Hi

I am trying to include the log4r gem but the interpreter doesn’t seem
to find it it keeps throwing my the following error

C:\Users\venkat\Documents\Projects\RuBravo\RubravoCore\lib\XmlEngine>ruby -d XmlEngine.rb

Exception LoadError' at C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:1106 - no >such file to load -- rubygems/defaults/operating_system ExceptionLoadError’ at >C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31 - no such file to >load – Log4r
Exception `NameError’ at XmlEngine.rb:35 - uninitialized constant >XmlEngine::Logger
XmlEngine.rb:35: uninitialized constant XmlEngine::Logger (NameError)

I found this post. But I am running on 1.8.6.
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/296791

Has anyone else faced similar problem?

Thanks
Venkat

Venkat A. wrote:

Hi

I am trying to include the log4r gem but the interpreter doesn’t seem
to find it it keeps throwing my the following error

C:\Users\venkat\Documents\Projects\RuBravo\RubravoCore\lib\XmlEngine>ruby -d XmlEngine.rb

Exception LoadError' at C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:1106 - no >such file to load -- rubygems/defaults/operating_system ExceptionLoadError’ at >C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31 - no such file to >load – Log4r
Exception `NameError’ at XmlEngine.rb:35 - uninitialized constant >XmlEngine::Logger
XmlEngine.rb:35: uninitialized constant XmlEngine::Logger (NameError)

You are getting confusing output by using ruby -d. Just try ruby, or
ruby -w, instead.

I can’t see your code, but you could try boiling it down to two or three
lines which reproduces the problem. It could be that you are simply
missing

require ‘logger’

Please see the attached file for the code.

Thanks for the reply to start with.

When I use

require “logger”

it is pointing to the Logger class from Ruby library.

I am trying to work with Log4r’s Logger class.

I have tried

require “log4r/logger”
ruby: No such file or directory – require (LoadError)

Similar output for this too

require “log4r”
ruby: No such file or directory – require (LoadError)

Suggestions

Thankyou

Venkat A. wrote:

Thanks for the reply to start with.

When I use

require “logger”

it is pointing to the Logger class from Ruby library.

I am trying to work with Log4r’s Logger class.

I have tried

require “log4r/logger”
ruby: No such file or directory – require (LoadError)

Similar output for this too

require “log4r”
ruby: No such file or directory – require (LoadError)

Suggestions

Did you install it as a gem? Then

require ‘rubygems’
require ‘log4r’

If not, then how did you install it?

Documentation is here:
http://log4r.sourceforge.net/
(follow links to the manual and to the RDoc API)

Also, from the error you originally posted, it looks like you tried to
instantiate a Logger, e.g. with Logger.new. Perhaps you need
Log4r::Logger.new

Also, from the error you originally posted, it looks like you tried to
instantiate a Logger, e.g. with Logger.new. Perhaps you need
Log4r::Logger.new

That did it. Thankyou

Venkat

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs