سؤال

I'm using Log4r's Log4j XML formatter to talk to Chainsaw as described here in Log4r's manual. However, basically all I'm getting is the message and warning level -- I'm not getting the additional details that seem to be shown there.

Here's the context in which I'm using it, which seems to me very similar to their (note I'm also using their example Chainsaw configuration file unmodified):

        @log = Log4r::Logger.new "#{self.class.name}"

        log4jformat = Log4r::Log4jXmlFormatter.new

        hostname = opts[:chainsaw_hostname] || DEFAULT_CHAINSAW_HOST
        port     = opts[:chainsaw_port]     || DEFAULT_CHAINSAW_PORT
        udpout = Log4r::UDPOutputter.new 'udp', :hostname => hostname, :port => port
        udpout.formatter = log4jformat

        @log.outputters = [udpout]

        @log.debug 'this is a message with level debug'

Any suggestions on this? Again I'm seeing the messages appear, they just don't have the additional details attached like the class/method/line where the log event occurred.

هل كانت مفيدة؟

المحلول

You have to explicitly turn tracing on for this to work. I just had to add the line:

@log.trace = true

and it worked immediately.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top