Log4r

The following code is throwing errors below. It looks like the wrong
module is getting referenced. The constructor for
c:\ruby\lib\ruby\1.8\Logger.rb takes 3-arguments. Seems to be some
confusion here. Can someone point me in the right direction?

Thanks!

require 'log4r'
include Log4r

#-- error getting thrown on this line
mylog = Logger.new('errorLogger.txt', nil, nil, true)

# 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)

···

#--
#-- errors
#--
wrong number of arguments (4 for 3)
testLogger.rb:18:in `initialize'
testLogger.rb:18
testLogger.rb:18:in `initialize': wrong number of arguments (4 for 3)
(ArgumentError)
  from testLogger.rb:18

--
Posted via http://www.ruby-forum.com/.

Logger.new() takes only three (not 4) parameters.

See http://log4r.sourceforge.net/rdoc/classes/Log4r/Logger.html.

Nicolai Reuschling wrote:

Logger.new() takes only three (not 4) parameters.

See http://log4r.sourceforge.net/rdoc/classes/Log4r/Logger.html\.

This is what threw me off...

    def initialize(_fullname, _level=nil, _additive=true, _trace=false)
      # validation
      raise ArgumentError, "Logger must have a name", caller if
_fullname.nil?
      Log4rTools.validate_level(_level) unless _level.nil?
      validate_name(_fullname)

      # create the logger
      @fullname = _fullname
      @outputters =
      @additive = _additive
      deal_with_inheritance(_level)
      LoggerFactory.define_methods(self)
      self.trace = _trace
      Repository[@fullname] = self
    end

···

--
Posted via http://www.ruby-forum.com/\.