从log4j 1.2迁移到log4j 2:LevelRangeFilter [英] Migrating from log4j 1.2 to log4j 2: LevelRangeFilter

查看:481
本文介绍了从log4j 1.2迁移到log4j 2:LevelRangeFilter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是log4j 2相当于下面的log4j 1.2配置?

What is the log4j 2 equivalent of the following log4j 1.2 configuration?

<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您可以简单地使用一个复合过滤器和两个ThresholdFilters:

Instead of having to create your own filter (http://bitfish.eu/java/log4j-2-multiple-appenders-with-different-log-levels/) you can simply use a composite filter with two ThresholdFilters:

<Filters>
    <ThresholdFilter level="DEBUG"/>
    <ThresholdFilter level="WARN" onMatch="DENY" onMismatch="NEUTRAL"/>
</Filters>

这篇关于从log4j 1.2迁移到log4j 2:LevelRangeFilter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆