[logback-user] MaxHistory does not delete old files

Ceki Gülcü ceki at qos.ch
Thu May 27 17:14:42 CEST 2010


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
>




More information about the Logback-user mailing list