Can't set LevelRangeFilter for log4j

2019-07-20 08:37发布

I am using this property file to setup log4j in Spring:

log4j.appender.EMAIL=org.apache.log4j.net.SMTPAppender
log4j.appender.EMAIL.filter=org.apache.log4j.varia.LevelRangeFilter
log4j.appender.EMAIL.filter.levelMin=FATAL

but getting:

log4j:WARN Failed to set property [filter] to value "org.apache.log4j.varia.LevelRangeFilter". 

Any ideas?

2条回答
我命由我不由天
2楼-- · 2019-07-20 08:50

From the docs for PropertyConfigurator:

The PropertyConfigurator does not handle the advanced configuration features supported by the DOMConfigurator such as support for Filters, custom ErrorHandlers, nested appenders such as the AsyncAppender, etc.

I suggest you use an XML file to set it up instead.

查看更多
爷、活的狠高调
3楼-- · 2019-07-20 09:09

You don't need a filter for this.

log4j.appender.EMAIL.Threshold=FATAL

查看更多
登录 后发表回答