# Problem using log4r Configurator object

**URL:** <https://www.ruby-forum.com/t/problem-using-log4r-configurator-object/115565>\
**Category:** Ruby\
**Created:** [September 26, 2007, 11:35am UTC](https://www.ruby-forum.com/t/problem-using-log4r-configurator-object/115565 "2007-09-26T11:35:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 26, 2007, 11:35am UTC](https://www.ruby-forum.com/t/problem-using-log4r-configurator-object/115565/1 "2007-09-26T11:35:50Z")

</div>

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\>  
  
\</pre\_config\>  
  
\</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
