如何使用Chainsaw查看自定义日志?

发布于 2024-08-19 18:51:52 字数 144 浏览 2 评论 0原文

我们有自定义的附加程序(com.mycompany.log4j.XAppender)和自定义布局(com.mycompany.log4j.XPatternLayout)。当 ChainSaw 打开日志文件时,它不断抱怨:发现不匹配的行:。如何解决这个问题?

We have customized appender (com.mycompany.log4j.XAppender) with customized layout (com.mycompany.log4j.XPatternLayout). While ChainSaw opens the log file, it keeps complaining: found non-matching line: . How to fix that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

榆西 2024-08-26 18:51:52

您提到 Chainsaw 正在打开日志文件,但不清楚如何打开。

您可以使用 Chainsaw 中的文件打开菜单打开 xmllayout 格式的日志文件。

您可以通过将 Chainsaw 配置为使用 LogFilePatternReceiver(它可以解析和读取日志)来在 Chainsaw 中加载常规文本日志文件。尾部日志文件(LogFilePatternReceiver 允许您在日志文件中定义模式,然后解析并尾部日志文件)。

Chainsaw 的“欢迎”选项卡中提供了示例接收器配置,而 LogFilePatternReceiver javadoc 则可从 Chainsaw 的帮助菜单中获得。

如果您有自定义 xml 格式,则需要创建自己的 XmlDecoder 实现,将 xml 转换为日志记录事件(并将 Chainsaw 配置为在解码器中使用基于 xml 的接收器),或者可以预处理 xml 文件并输出符合log4j的dtd的文件。

上面的“找到不匹配的行”消息看起来像是基于 xmllayout 的格式。如果您在加载符合 log4j dtd 的日志文件时遇到问题,我建议您将带有问题的日志文件示例块发布到 log4j-dev 邮件列表。

You mention Chainsaw is opening the log file, but it's not clear how.

You can open an xmllayout-formatted log file using the file-open menu in Chainsaw.

You can load a regular text log file in chainsaw by configuring Chainsaw to use a LogFilePatternReceiver, which can parse & tail the log file (LogFilePatternReceiver allows you to define the pattern in your log file, and will then parse and tail the log file).

An example receiver configuration is available from Chainsaw's Welcome tab, and LogFilePatternReceiver javadoc is available from Chainsaw's help menu.

If you have a custom xml format, you need to either create your own XmlDecoder implementation that will convert your xml to logging events (and configure Chainsaw to use an xml-based receiver with your decoder), or you can pre-process your xml file and output a file conforming to log4j's dtd.

The 'found non-matching line' message above looks like it is an xmllayout-based format. If you're having problems loading a log file that conforms to log4j's dtd, I'd suggest posting an example chunk of your log file with a question to the log4j-dev mailing list.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文