2

Logback can't split the log by minute correctly. The time in the file name is always the minute when program started. And the same problem will accrue when Logback split the log by day.

Here is the configuration for my logback.xml section:

<appender name="FILE-INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
  <filter class="ch.qos.logback.classic.filter.LevelFilter">
    <level>INFO</level>
    <OnMismatch>DENY</OnMismatch>
    <OnMatch>NEUTRAL</OnMatch>
  </filter>

  <file>${LOG_HOME}/andshi_deliverer.log</file>
  <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
    <fileNamePattern>
                ${LOG_HOME}/%d{yyyyMM}/andshi_deliverer_%d{HH.mm}.log.%i.gz
    </fileNamePattern>
    <maxFileSize>3MB</maxFileSize>
  </rollingPolicy>

  <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
    <pattern>${LOG_PATTERN}</pattern>
  </encoder>
</appender>

Here is my gz files:

enter image description here

Titulum
  • 9,928
  • 11
  • 41
  • 79
Alvin
  • 33
  • 4
  • 1
    I think it's a bug, please go through https://stackoverflow.com/questions/47752955/logback-sizeandtimebasedrollingpolicy-applies-totalsizecap-to-each-day-in-maxhi?rq=1 – Vivek Jan 14 '20 at 09:35

0 Answers0