2011-09-19 27 views
0

我使用Log4r的Log4j XML格式化程序與電鋸交談,如here in Log4r's manual所述。然而,基本上我得到的只是信息和警告級別 - 我沒有看到那裏顯示的額外細節。Log4r和Chainsaw:收集其他日誌消息的詳細信息(行號等)?

這裏的語境中,我使用它,這在我看來很相似,他們(注意我還使用了例如電鋸配置文件修改的):

 @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' 

對此有何建議?我再次看到這些消息出現,他們只是沒有附加額外的細節,例如發生日誌事件的類/方法/行。

+1

介意試用最新的開發者快照?許多新功能,更穩定...可在這裏:http://people.apache.org/~sdeboy – Scott

+0

@斯科特,謝謝 - 現在挖掘它。看起來很不錯! –

回答

0

您必須明確地打開tracing才能使其工作。我只是要添加行:

@log.trace = true 

它立即工作。