log4j StringToMatch in property file

后端 未结 2 732
猫巷女王i
猫巷女王i 2020-12-05 07:29

I have following XML configration i would like to convert to java property file.

I am getting below error

log4j:WARN Failed to set property [filter]         


        
相关标签:
2条回答
  • 2020-12-05 08:04

    Properties files don't support filters. You'll have to switch to an XML configuration.

    From the documentation of Filter :

    Note that filtering is only supported by the DOMConfigurator. The PropertyConfigurator does not support filters.


    Resources :

    • log4j - Filter

    On the same topic :

    • Why chose XML over properties files for Log4J configuration?
    0 讨论(0)
  • 2020-12-05 08:13
    log4j.appender.console=org.apache.log4j.ConsoleAppender
    log4j.appender.console.layout=org.apache.log4j.PatternLayout
    log4j.appender.console.layout.ConversionPattern=%d %-6p [%c] %m%n
    log4j.appender.console.filter.1=org.apache.log4j.varia.StringMatchFilter
    log4j.appender.console.filter.1.StringToMatch=entered
    log4j.appender.console.filter.1.AcceptOnMatch=true
    log4j.appender.console.filter.2=org.apache.log4j.varia.DenyAllFilter
    

    does work

    0 讨论(0)
提交回复
热议问题