Log4j different appenders for different log levels using properties file

后端 未结 2 1199
时光说笑
时光说笑 2020-12-28 13:38

Since the official documentation for log4j is a broken link, and the getting started guide isn\'t helping me, I would like to know how to use two appenders with different lo

相关标签:
2条回答
  • 2020-12-28 13:45

    Also, if you want to specify the appender at the package level, you can use:

    log4j.logger.[package]=[Level], [Appender]
    

    Example:

    log4j.logger.org.apache.cxf=INFO, MyAppender
    

    For more details, please, take a look at: https://stackoverflow.com/a/19795886/679240

    0 讨论(0)
  • 2020-12-28 13:55

    You need to set the logger to the more detailed of the two levels (DEBUG) but then set a threshold on the appender to tell it to only show messages at INFO and above

    log4j.appender.APPENDER_STDOUT.Threshold=INFO
    
    0 讨论(0)
提交回复
热议问题