DailyRollingFileAppender is not creating daily backup log file.
I am using the below config, which works on my local machine but it not working on the machine where my project has been deployed.
log4j.rootLogger=DEBUG, Appender2
log4j.appender.Appender2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.Appender2.File=C:/Logs/AppLog.log
log4j.appender.Appender2.DatePattern='.'dd-MM-yyyy
log4j.appender.Appender2.layout=org.apache.log4j.PatternLayout
log4j.appender.Appender2.layout.ConversionPattern=%-7p %d [%t] %c %x - %m%n
log4j.appender.Appender2.rootLogger = DEBUG
Framework - Spring MVC
I am not able to understand which part of the config is bloking DailyRollingFileAppender to create date wise log on my server machine.
Edit-
I updated my file as per the suggestion and it is not creating a new backup file at 12 am next day. means it updated AppLog.log till 12 then there was no backup file and all the previous day logs are gone and it starts writing from the beginning.
This is log4j properties now-
log4j.rootLogger=DEBUG, Appender2
log4j.appender.Appender2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.Appender2.File=${catalina.home}/Logs/AppLog.log
log4j.appender.Appender2.DatePattern='.'yyyy-MM-dd
log4j.appender.Appender2.layout=org.apache.log4j.PatternLayout
log4j.appender.Appender2.Append=false
log4j.appender.Appender2.layout.ConversionPattern=%-7p %d [%t] %c %x - %m%n
your DatePattern should be '.'yyyy-MM-dd
refer to https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html