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

Logback fails to roll once the file count exceeds 1000

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.2.3
    • None
    • Windows Server 2012 R2

      Processor: Intel Xeon CPU E5-2676 v3 @ 2.40GHz

      Memory: 4Gb

    Description

      Using the configuration below, copied from Chapter 4: Appenders, of the Logback Manual I've modified the maxFileSize, maxHistory, and totalSizeCap values.

      <?xml version="1.0" encoding="UTF-8"?>
      <!-- -Dlogback.configurationFile=/path/to/config.xml -->
      <configuration scan='true' scanPeriod='30 seconds'><appender name='FILE' class='ch.qos.logback.core.rolling.RollingFileAppender'>
      {{ <file>3mlogqueueforwardservice.log</file>}}
      {{ <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">}}
      {{ <!-- rollover daily -->}}
      {{ <fileNamePattern>3mlogqueueforwardservice-%d{yyyy-MM-dd}.%i.log</fileNamePattern>}}
      {{ <!-- each file should be at most 5MB, keeping 15 days worth of history, but at most 200MB -->}}
      {{ <maxFileSize>20MB</maxFileSize>}}
      {{ <!-- the maximum number of archive files to keep, asynchronously deleting older files -->}}
      {{ <maxHistory>2</maxHistory>}}
      {{ <!-- the total size of all archive files -->}}
      {{ <totalSizeCap>100MB</totalSizeCap>}}
      {{ </rollingPolicy>}}
      {{ <encoder>}}
      {{ <charset>UTF-8</charset>}}
      {{ <pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>}}
      {{ </encoder>}}
      {{ </appender>}}<logger name="com.mmm.his" level='info' additivity='false'>
      {{ <appender-ref ref='FILE' />}}
      {{ </logger>}}

      {{ <root level='warn'>}}
      {{ <appender-ref ref='FILE' />}}
      {{ </root>}}

      </configuration>

      For this configuration I should only ever have 5 files of ~20mb. The rolling functionality appears to work fine when the index %i is < 1000, after which the totalSizeCap fails and files are endlessly written at ~20mb until all the available space on the machine is consumed.  The log files contain no indication of Logback failing...

      The two images attached show the log file rolling successfully and then failing to remove files as the index increases > 1000.  I've replicated this several times, but only by watching the logs grow and inspecting the contents of the log; our application collects and logs rather quickly.

      Is there an interim solution?  We're stucking restarting and deleting each time the problem occurs.

      Attachments

        Activity

          People

            logback-dev Logback dev list
            jflores6 Jason Flores
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated: