开发者

How do I filter certain lines from a log4j stack trace?

I want to filter out certain lines from stack traces using log4j (like net.sf.cglib.* and org.sprin开发者_运维百科gframework.*). Is it possible to configure this with log4j?

In eclipse the junit plugin allows you to add filters which modify the stack traces displayed in the junit tab, but this doesn't change the stack traces output to the console.


Use this filtering layout log4j add-on: http://www.openmindlab.com/lab/tools/openutilslog4j/layout.html

They have an example with log4j.xml on that page. Just use the it.openutils.log4j.FilteredPatternLayout instead of the log4j PatternLayout, and then put some entries like

    <param name="Filter" value="net.sf.cglib"/>
    <param name="Filter" value="org.springframework"/>

below.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜