开发者

Log4r and Chainsaw: gathering additional log message details (line number, etc.)?

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 addition开发者_运维百科al 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜