Filename with date in Log4j

后端 未结 3 1126
轮回少年
轮回少年 2020-12-09 23:06

I\'m trying to append the current date to the log4j log file. So it would be something like this:

myApp-2011-01-07.log

The thing is that I do not want to us

3条回答
  •  伪装坚强ぢ
    2020-12-09 23:15

    Try setting this in your log4j.properties file:

    log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.R.File=example.log
    

    much more information can be found here http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html

提交回复
热议问题