uninitialized constant XmlEngine::Logger (NameError)

V

Venkat Akkineni

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
Exception `LoadError' 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

Attachments:
http://www.ruby-forum.com/attachment/3896/XmlEngine.rb
 
B

Brian Candler

Venkat said:
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

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'
 
V

Venkat Akkineni

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
 
B

Brian Candler

Venkat said:
Thanks for the reply to start with.

When I use


it is pointing to the Logger class from Ruby library.

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

I have tried


Similar output for this too


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
 
V

Venkat Akkineni

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top