Log4r 和 Chainsaw:收集额外的日志消息详细信息(行号等)?
我正在使用 Log4r 的 Log4j XML 格式化程序与 Chainsaw 进行交互,如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'
对此有什么建议吗?我再次看到消息出现,它们只是没有附加附加详细信息,例如发生日志事件的类/方法/行。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须显式打开跟踪才能实现此功能。我只需要添加一行:
它就立即起作用了。
You have to explicitly turn tracing on for this to work. I just had to add the line:
and it worked immediately.