以下log4j 1.2配置的log4j 2等效是什么?
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="DEBUG" />
<param name="LevelMax" value="INFO" />
</filter>
答案 0 :(得分:9)
您无需创建自己的过滤器(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>