[logback-dev] [JIRA] Created: (LBCORE-146) SiftingAppender TimeBasedRollingPolicy MaxHistory not deleting old files

Hrotkó Gábor (JIRA) noreply-jira at qos.ch
Wed Mar 24 12:37:16 CET 2010


SiftingAppender TimeBasedRollingPolicy MaxHistory not deleting old files
------------------------------------------------------------------------

                 Key: LBCORE-146
                 URL: http://jira.qos.ch/browse/LBCORE-146
             Project: logback-core
          Issue Type: Bug
          Components: Rolling
    Affects Versions: 0.9.18
         Environment: linux64, jdk1.6.0_17-b04, apache-tomcat-6.0.24
            Reporter: Hrotkó Gábor
            Assignee: Logback dev list


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{yyyy-MM-dd}.log</FileNamePattern>
          <!-- 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>
...




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       


More information about the logback-dev mailing list