Log4J过滤器层次结构
过滤包含slow字符串的日志
<filter class="org.apache.log4j.varia.StringMatchFilter">
<param name="StringToMatch" value="slow" />
<param name="AcceptOnMatch" value="false" />
</filter>
设置只包含aduit字符串的日志
<appender name="audit" class="xxxRollingFileAppender" >
<param name="Append" value="true"/>
<param name="Threshold" value="INFO"/>
<param name="File" value="xxx.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %p %c - %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.StringMatchFilter">
<param name="StringToMatch" value="AUDIT" />
<param name="AcceptOnMatch" value="true" />
</filter>
<filter class="org.apache.log4j.varia.DenyAllFilter"/>
</appender