开发者

How to view customized logs with 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?


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜