如何使用日志文件
通常,在我在编辑器中打开日志之前,我会通过大量的 grep 管道来消除“噪音”。
我认为应该可以在编辑器(尤其是 Emacs)内进行此过滤,
这是链锯正在做的事情吗?仅适用于 log4j 格式还是更通用? (这是我能找到的唯一日志文件查看器工具)
你们是怎么做到的? (我认为 UNIX grep 语法对我来说是最简单的)
Usually I pipe my log through a lot of greps to remove the "noise" before i open it in an editor.
I think it should be possible to do this filtering inside an editor (Especially Emacs)
Is this what chainsaw is doing? For log4j format only or more general?
(It is the only logfile viewer tool I can find)
How do you guys do it?
(I think UNIX grep syntax would be easiest for me)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Chainsaw 支持正向和负向滤波器匹配。您可以根据记录器树定义正匹配和负匹配(右键单击选项的节点),并且可以在“优化焦点”字段中定义正匹配表达式,并使用下面的“忽略”选项定义负匹配表达式记录器树。帮助菜单中有一个教程,其中描述了表达式语法。
自上次正式发布以来,Chainsaw 添加了许多新功能。开发人员快照(包括重新设计的配置屏幕)可在此处获取:
http://people.apache.org/~sdeboy
Chainsaw 不仅仅适用于 log4j。有一些“接收器”可以使其与 log4net、java.util.logging、log4php 等一起使用。
您还可以使用 VFSLogFilePatternReceiver 处理任何常规格式的文本文件(使用“处理日志文件”选项来配置 Chainsaw 来定义一个文件)。配置对话框中有一些预定义的日志格式可用作示例格式 - 调整一种格式以匹配您的格式。 JavaDoc 提供了更多信息: http://logging .apache.org/chainsaw/apidocs/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.html
Chainsaw does support both positive and negative filter matching. You can define positive and negative matches based on the logger tree (right click on nodes for the options), and you can define positive-match expressions in the 'refine focus' field, and negative-match expressions using the 'ignore' option below the logger tree. There is a tutorial available from the help menu which describes the expression syntax.
Chainsaw has had a lot of new features added since the last official release. The developer snapshot (including a reworked configuration screen) is available here:
http://people.apache.org/~sdeboy
Chainsaw doesn't just work with log4j. There are 'receivers' available that make it work with log4net, java.util.logging, log4php and others.
You can also process any regularly formatted text file using a VFSLogFilePatternReceiver (use the 'process a log file' option to configure Chainsaw to define one). There are some pre-defined log formats in the configuration dialog that act as example formats - tweak one to match your format. The JavaDoc provides more information: http://logging.apache.org/chainsaw/apidocs/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.html
如果 grep 相同,您可以简单地编写一个脚本来为您完成所有工作(例如 vimscript 对于 vi)。这样,您就不必重复所有任务,同时保留完整的日志以供进一步调查。
你说得对的是链锯和log4j——它是一个具有不同功能的日志查看器,例如过滤机制。但是,我不确定您是否能够同时激活多个过滤器。
If the greps are the same, you can simply code a script to do all that work for you (e.g. vimscript for vi). That way, you don't have to repeat all the tasks while leaving the logs intact for further investigation.
You're right on chainsaw and log4j - it's a logging viewer with different capabilities, e.g. a filter mechanism. However, I am unsure, if you are able to have multiple filters activated simultaneously.
是的,您应该首先尝试 Chainsaw..它确实支持各种获取日志的方式。
Yes, you should try Chainsaw first.. it does support various ways of getting your logs.
Necroposting:我创建了一个 Emacs 模式,专门针对类似 Log4j 的日志,但支持更多格式,特别是如果您为自己定制的话。
特点:
Mw
)可见文本,与过滤配合良好(这是可定制的)Necroposting: I created a mode for Emacs that is specifically targeted at Log4j-like logs, but supports many more formats, especially if you customize it for yourself.
Features:
M-w
) only visible text, goes well with filtering (this is customizable)