how to make log4j to write to the console as well

后端 未结 4 789
傲寒
傲寒 2020-11-29 00:45

Is there any way to tell to log4j to write its log to the file and to the console? thanks there are my properties:

log4j.rootLogger=DEBUG,console,R
log4j.roo         


        
4条回答
  •  一个人的身影
    2020-11-29 01:09

    This works well for console in debug mode

    log4j.appender.console=org.apache.log4j.ConsoleAppender
    log4j.appender.console.Threshold=DEBUG
    log4j.appender.console.Target=System.out
    log4j.appender.console.layout=org.apache.log4j.PatternLayout
    log4j.appender.console.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p - %m%n
    

提交回复
热议问题