Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-162

RollingPolicy MaxHistory not deleting old files

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: logback-core
    • Labels:
      None
    • Environment:

      linux 2.6.18 64bits apache-tomcat-6.0.20 java/jre1.6.0_18

      Description

      The MaxHistory does not do the trick : the old files are not deleted at all :
      cat logging.xml
      <appender name="IDP_ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
      <File>/shibboleth-idp/logs/idp-access.log</File>
      <Append>false</Append>
      <ImmediateFlush>true</ImmediateFlush>

      <RollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <FileNamePattern>/shibboleth-idp/logs/old/idp-access-%d

      {yyyy-MM-dd_HH-mm}

      .log.gz</FileNamePattern>
      <MaxHistory>3</MaxHistory>
      </RollingPolicy>

      <layout class="ch.qos.logback.classic.PatternLayout">
      <Pattern>%msg%n</Pattern>
      </layout>
      </appender>

        Issue Links

          Activity

          Hide
          sthomps Shaun thompson added a comment -

          I'm currently referencing the latest logback 0.9.30 version and I'm not seeing my log history deleted correctly.

          Possible configuration issue?

          Here's my log policy

          <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
          <file>XXX.log</file>
          <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
          <!-- rollover daily -->
          <fileNamePattern>XXX-%d

          {yyyy-MM-dd}

          .%i.log</fileNamePattern>
          <MaxHistory>7</MaxHistory>
          <timeBasedFileNamingAndTriggeringPolicy
          class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
          <maxFileSize>5MB</maxFileSize>
          <MaxHistory>3</MaxHistory>
          </timeBasedFileNamingAndTriggeringPolicy>
          </rollingPolicy>
          <encoder class="CustomPatternLayoutEncoder">
          <pattern>[%p] [%d

          {ISO8601}

          ] [%ip_address] [%user_id] [%c] [%m]%n</pattern>
          </encoder>
          </appender>

          Here's a history of the log files that are still out there.

          XXX-2011-08-26.0.log
          XXX-2011-08-29.0.log
          XXX-2011-08-30.0.log
          XXX-2011-09-09.0.log
          XXX-2011-09-16.0.log
          XXX-2011-09-23.0.log
          XXX-2011-09-27.0.log
          XXX-2011-09-28.0.log
          XXX-2011-09-29.0.log
          XXX-2011-09-30.0.log
          XXX-2011-10-02.0.log
          XXX-2011-10-03.0.log

          Show
          sthomps Shaun thompson added a comment - I'm currently referencing the latest logback 0.9.30 version and I'm not seeing my log history deleted correctly. Possible configuration issue? Here's my log policy <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>XXX.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- rollover daily --> <fileNamePattern>XXX-%d {yyyy-MM-dd} .%i.log</fileNamePattern> <MaxHistory>7</MaxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>5MB</maxFileSize> <MaxHistory>3</MaxHistory> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> <encoder class="CustomPatternLayoutEncoder"> <pattern> [%p] [%d {ISO8601} ] [%ip_address] [%user_id] [%c] [%m] %n</pattern> </encoder> </appender> Here's a history of the log files that are still out there. XXX-2011-08-26.0.log XXX-2011-08-29.0.log XXX-2011-08-30.0.log XXX-2011-09-09.0.log XXX-2011-09-16.0.log XXX-2011-09-23.0.log XXX-2011-09-27.0.log XXX-2011-09-28.0.log XXX-2011-09-29.0.log XXX-2011-09-30.0.log XXX-2011-10-02.0.log XXX-2011-10-03.0.log
          Hide
          noreply.ceki@qos.ch Ceki Gulcu added a comment -

          Shaun, could you provide more detail about your application. In particular, how frequently is your application started/stopped. Do you think you are in the same scenario as the one described in LBCORE-226 ?

          Show
          noreply.ceki@qos.ch Ceki Gulcu added a comment - Shaun, could you provide more detail about your application. In particular, how frequently is your application started/stopped. Do you think you are in the same scenario as the one described in LBCORE-226 ?
          Hide
          sthomps Shaun thompson added a comment -

          That could definitely be a possibility. The logs I'm looking at are for a development application so the start/stop frequency varies widely - anywhere from several times a day to once in a couple of weeks.

          Show
          sthomps Shaun thompson added a comment - That could definitely be a possibility. The logs I'm looking at are for a development application so the start/stop frequency varies widely - anywhere from several times a day to once in a couple of weeks.
          Hide
          pdecat Patrick Decat added a comment -

          For the record, the corresponding commit have been relocated at https://github.com/qos-ch/logback/commit/524e0fc13ecc4fb24d

          Show
          pdecat Patrick Decat added a comment - For the record, the corresponding commit have been relocated at https://github.com/qos-ch/logback/commit/524e0fc13ecc4fb24d
          Hide
          ceefour Hendy Irawan added a comment -

          Thank you!!!!

          Show
          ceefour Hendy Irawan added a comment - Thank you!!!!

            People

            • Assignee:
              noreply.ceki@qos.ch Ceki Gulcu
              Reporter:
              diazmaurin Rafael Diaz Maurin
            • Votes:
              10 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: