[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Problem using log4r Configurator object

sramazzina

9/26/2007 9:32:00 AM

Hi anyone,

I'm new to ruby and I've a question about log4r and its Configurator
object. I read the manual, really short, and tried some samples. I
would like to try to use the Configurator object and so I tried to put
together a sample. So I made the following confguration file (really
simple called sample-log4rconfig.xml)

<log4r_config>
<pre_config>
<global level="DEBUG"/>
</pre_config>
<outputter type="StdoutOutputter"/>
</log4r_config>

and I built this really simple ruby program that uses it

require 'log4r'
include Log4r


# Configure the system using a Configurator object
Configurator.load_xml_file 'sample-log4rconfig.xml'

# create a logger named 'Test1Logger' that logs to stdout
mylog = Logger.new 'Test1Logger'
#mylog.outputters = Outputter.stdout

# Now we can log.
def do_log(log)
log.debug "This is a message with level DEBUG"
log.info "This is a message with level INFO"
log.warn "This is a message with level WARN"
log.error "This is a message with level ERROR"
log.fatal "This is a message with level FATAL"
end
do_log(mylog)

As soon as I start the program the system gives me the following error
message:
simple_test2.rb:6: uninitialized constant Configurator (NameError)

Anyone tried to use the log4r this way and can help me to solve my
issue?
Thank you very much to anyone who will try to help me

Kind regards

Sergio