Very simple log4j2 properties configuration file using Console and Rolling File appender

后端 未结 3 2014
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-01 21:54

I\'d like a log4j2 properties file configuration with a console and a rolling file appender using log4j2 that can be used different application. The log configuration should rot

3条回答
  •  清酒与你
    2021-02-01 22:48

    This is the simplest config if you just need to use console appender.

    name=config
    appenders=console
    appender.console.type=Console
    appender.console.name=STDOUT
    appender.console.layout.type=PatternLayout
    #appender.console.layout.pattern =%d{HH:mm:ss} [%t] %c{1} [%-5level] - %msg%n
    appender.console.layout.pattern=%d{dd-MM-yyyy HH:mm:ss} [%-5p] (%F:%L) - %m%n
    rootLogger.level=info
    rootLogger.appenderRefs=stdout
    rootLogger.appenderRef.stdout.ref=STDOUT
    
    #if you want to make package specific configuration
    #logger.org.apache=warn
    

提交回复
热议问题