I’m using the following setting in log4j.properties. However, it generates a file like MyLog.log.2010-11-26 during roll over. Is there a way I can make it MyLog-2010-11-26.log?
log4j.appender.fileLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.fileLog.DatePattern='.'yyyy-MM-dd
log4j.appender.fileLog.File=logs/MyLog.log
I can make DatePattern='.'yyyy-MM-dd'.log' but it makes it MyLog.log.2010-11-26.log. Is there a way to modify File setting so I can insert the DatePattern?
Thanks.
You could try using
org.apache.log4j.rolling.RollingFileAppenderfrom the apache-log4j-extras package; that appears to be able to do the thing that you want if you configure it right. I think that the example configuration on that file is only trivially different from what you require.