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

SizeAndTimeBasedRollingPolicy do not delete the old files

    XMLWordPrintable

Details

    Description

      I configured the  archive file structure as specified by the below configuration

      <appender name="SCHEDULER" class="ch.qos.logback.core.rolling.RollingFileAppender">
      <File>${LOG_HOME}/scheduler.log</File>
      <encoder>
      <pattern>%d %p [%t] [%X

      {serviceName}

      ] [%X

      {username}

      ] %X{someOtherName} %logger{10} - %m%n</pattern>
      </encoder>
      <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
      <fileNamePattern>${LOG_HOME}/archive/%d{yyyy/MM/dd}/scheduler.%i.log.gz</fileNamePattern>
      <maxHistory>5</maxHistory>
      <totalSizeCap>2GB</totalSizeCap>
      <maxFileSize>50MB</maxFileSize>
      </rollingPolicy>
      </appender>

       

      The date and time is not attached to the file name but folder is created for each day. This does not delete the old files above 5 days old. 

       

      14:28:25,761 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
      14:28:25,761 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [SCHEDULER]
      14:28:25,762 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
      14:28:25,764 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@373743439 - Archive files will be limited to [50 MB] each.
      14:28:25,764 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@373743439 - Will use gz compression
      14:28:25,765 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@373743439 - Will use the pattern /usr/local/xxx/applications/tomcat-fatcontroller-8080/logs/archive/%d{yyyy/MM/dd}/scheduler.%i.log for the active file
      14:28:25,766 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@6963b364 - The date pattern is 'yyyy/MM/dd' from file name pattern '/usr/local/xxx/applications/tomcat-fatcontroller-8080/logs/archive/%d{yyyy/MM/dd}/scheduler.%i.log.gz'.

      14:28:25,766 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@6963b364 - Roll-over at midnight.
      14:28:25,767 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@6963b364 - Setting initial period to Fri Aug 18 14:28:25 BST 2017
      14:28:25,768 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[SCHEDULER] - Active log file name: /usr/local/xxx/applications/tomcat-fatcontroller-8080/logs/scheduler.log
      14:28:25,768 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[SCHEDULER] - File property is set to [/usr/local/xxx/applications/tomcat-fatcontroller-8080/logs/scheduler.log]

      Attachments

        Activity

          People

            logback-dev Logback dev list
            seeni seenimurugan shanmugam
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: