I use TimeBasedRollingPolicy and RollingFileAppender so that my logs are redirected and archived as myLogFileName..log.gz:
<appender class="org.apache.log4j.rolling.RollingFileAppender" name="myLogFile"> <param value="/var/log/my/myLogFileName.log" name="File"/> <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy"> <param name="FileNamePattern" value="/var/log/my/myLogFileName.%d.log.gz" /> </rollingPolicy> <layout class="org.apache.log4j.PatternLayout"> <param value="%d [%t] %-5p - %m%n" name="ConversionPattern"/> </layout> </appender>
What I donβt understand - where is it determined when and how will really old archive files be completely deleted from the file system?
And, if I want to always always store only files no older than one month old - where can I configure it (using log4j (optional))?
source share