MaxHistory does not delete old files

Hello. This was reported in previous versions on logback that MaxHistory does not delete old files. This bug is still present in 0.9.21. I tried numerous of configs and nothing. example : <appender name="STD" class="ch.qos.logback.core.rolling.RollingFileAppender"> <Append>true</Append> <File>${log.dir}/log.log</File> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%date{HH:mm:ss} %msg%n</pattern> </layout> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${log.arch.dir}/log%d{yyyy-MM-dd}.log</fileNamePattern> <MaxHistory>5</MaxHistory> </rollingPolicy> </appender> I have also tried : <TimeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <MaxHistory>5</MaxHistory> </TimeBasedFileNamingAndTriggeringPolicy> And still old files were not deleted. Can anyone advice ? I do smth wrong ? Being desperate I will delete all those files in my java code. greets Tomasz

You should add the following to the beginning of your config file to see logback's attempts, if any, at deleting the files: <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> Is your application long-lived or short-lived? Does it come up for a short while and shut down? On 27/05/2010 5:07 PM, viral wrote:
Hello. This was reported in previous versions on logback that MaxHistory does not delete old files. This bug is still present in 0.9.21. I tried numerous of configs and nothing.
example : <appender name="STD" class="ch.qos.logback.core.rolling.RollingFileAppender"> <Append>true</Append> <File>${log.dir}/log.log</File> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%date{HH:mm:ss} %msg%n</pattern> </layout> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${log.arch.dir}/log%d{yyyy-MM-dd}.log</fileNamePattern> <MaxHistory>5</MaxHistory> </rollingPolicy> </appender>
I have also tried : <TimeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <MaxHistory>5</MaxHistory> </TimeBasedFileNamingAndTriggeringPolicy>
And still old files were not deleted. Can anyone advice ? I do smth wrong ? Being desperate I will delete all those files in my java code.
greets
Tomasz

My application is shot-lived but even if I will force it to run longer, even if I will trigger midnight event delete does not occur only renaming : 00:00:07,171 |-INFO in c.q.l.co.rolling.helper.RenameUtil - Renaming file [.\logs\log.log] to [.\logs\arch\log-2010-05-29.log] Renaming works also on application startup which is great for me. Thanks for answer. Tomasz Piec You should add the following to the beginning of your config file to see logback's attempts, if any, at deleting the files: <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> Is your application long-lived or short-lived? Does it come up for a short while and shut down? On 27/05/2010 5:07 PM, viral wrote: > Hello. > This was reported in previous versions on logback that MaxHistory does not > delete old files. > This bug is still present in 0.9.21. > I tried numerous of configs and nothing. > > example : > <appender name="STD" > class="ch.qos.logback.core.rolling.RollingFileAppender"> > <Append>true</Append> > <File>${log.dir}/log.log</File> > <layout class="ch.qos.logback.classic.PatternLayout"> > <pattern>%date{HH:mm:ss} %msg%n</pattern> > </layout> > <rollingPolicy > class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> > <fileNamePattern>${log.arch.dir}/log%d{yyyy-MM-dd}.log</fileNamePattern> > <MaxHistory>5</MaxHistory> > </rollingPolicy> > </appender> > > I have also tried : > <TimeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> > <MaxHistory>5</MaxHistory> > </TimeBasedFileNamingAndTriggeringPolicy> > > And still old files were not deleted. Can anyone advice ? > I do smth wrong ? > Being desperate I will delete all those files in my java code. > > greets > > Tomasz > _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
participants (2)
-
Ceki Gülcü
-
viral