log4j 2的以下配置与log4j 1.2等效吗?
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="DEBUG" />
<param name="LevelMax" value="INFO" />
</filter>
你无需自己创建过滤器(http://bitfish.eu/java/log4j-2-multiple-appenders-with-different-log-levels/),只需使用两个ThresholdFilters组成的复合过滤器即可:
<Filters>
<ThresholdFilter level="DEBUG"/>
<ThresholdFilter level="WARN" onMatch="DENY" onMismatch="NEUTRAL"/>
</Filters>
<LevelRangeFilter minLevel="DEBUG" maxLevel="DEBUG" onMatch="ACCEPT" onMismatch="DENY"/>
<Console name="stdout" target="SYSTEM_OUT">
<PatternLayout ...
<LevelRangeFilter minLevel="INFO" maxLevel="ALL" onMatch="ACCEPT" onMismatch="DENY"/>
</Console>
<Console name="stderr" target="SYSTEM_ERR">
<PatternLayout ...
<LevelRangeFilter minLevel="FATAL" maxLevel="WARN" onMatch="ACCEPT" onMismatch="DENY"/>
</Console>
.properties
文件中进行相同的操作呢? - Aqeel Ashiq