Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
-
linux64, jdk1.6.0_17-b04, apache-tomcat-6.0.24
Description
When I use SiftingAppender with TimeBasedRollingPolicy, old files does not get deleted when the MaxHistory is set.
logback.xml snipet:
<configuration debug="true" scan="true" scanPeriod="5 seconds">
<appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<Key>userid</Key>
<DefaultValue>base</DefaultValue>
</discriminator>
<sift>
<appender name="FILE-${userid}" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>/usr/local/tomcat6/logs/myLog_${userid}.log</File>
<Append>false</Append>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d [%thread] %level %mdc %logger.%method:%line - %msg%n</Pattern>
</layout>
<RollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>/usr/local/tomcat6/logs/myLog_${userid}.%d
<!-- not working -->
<MaxHistory>2</MaxHistory>
</RollingPolicy>
</appender>
</sift>
</appender>
...
With the config above, the files gets sifted and rolled well, but old files not deleted.
When I change the filenames, and delete the ${userid} sifting, it works well.
...
<File>/usr/local/tomcat6/logs/myLog.log</File>
...
<FileNamePattern>/usr/local/tomcat6/logs/myLog.%d{yyyy-MM-dd}
.log</FileNamePattern>
...