logback的SizeBasedTriggeringPolicy和TimeBasedRollingPolicy联合使用问题
<appender name="FILE"class="ch.qos.logback.core.rolling.RollingFileAppender"><file>/var/log/testglog</file><rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"><!-- daily rollover --><fileNamePattern>/var/log/test.%d{yyyy-MM-dd}.log</fileNamePattern><!-- keep 30 days' worth of history --><maxHistory>30</maxHistory></rollingPolicy><triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"><maxFileSize>10MB</maxFileSize></triggeringPolicy> <encoder ><Pattern>%-15d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{0}[%file:%line] - %msg%n %ex{2}</Pattern> <charset>UTF-8</charset> <immediateFlush>true</immediateFlush></encoder></appender>
?
上面SizeBasedTriggeringPolicy和TimeBasedRollingPolicy联合使用方式有问题,当size超过10M后并没有触发TimeBasedRolling生效,见http://jira.qos.ch/browse/LOGBACK-73
正确的配置是:Size and time based archiving
?