Search code examples
javaspringlog4j

Can't set LevelRangeFilter for log4j


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?


Solution

  • 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.