A solution for directly entering a file with the current active date / time, for example XYZ.log.20150101.log, instead of XYZ.log can be done by simply removing the ActiveFileName property when using the rolling package org.apache.log4j. roll.RollingFileAppender in apache-log4j-extras 1.1 with log4j 1.2.x.
<appender name="defaultFileAppender" class="org.apache.log4j.rolling.RollingFileAppender"> <param name="append" value="true" /> <param name="Threshold" value="INFO" /> <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy"> <param name="FileNamePattern" value="${catalina.base}/logs/application/custom-application-logger.%d{yyyy-MM-dd_HH_mm}" /> </rollingPolicy> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p %-10t [%-40.40c] %x - %m%n" /> </layout> </appender>
source share