Problem using log4r Configurator object

S

sramazzina

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
 

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

Similar Threads

Log4r 1
conflict between active record and Log4R 1
net/ssh makes log4r fail 0
[ANN] Logging 0.1.0 5
Debug level errors with log4r 0
Tips for using Github??? 3
Question about Lo4R 3
Problem with KMKfw libraries 1

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top