* logback version 1.2.3
what I expect:
1. If you cross days, regenerate a log file
2. If the log file size exceeds 4MB, regenerate a log file
3. The date information in the log file name is the time information when the log is generated.
4. Clean up the log files 100 days ago
5, and the log files that store 1GB at most
. I use the configuration
below to get the result that if the newly generated log file is on the same day as the previous log file, then the time information remains the same as in the following figure
configure as follows
<appender name="TEST-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 4MB1MB-->
<fileNamePattern>${TEST_FILE_PATH}/xweb.%d{yyyyMMdd}_%d{HHmmssSSS,aux}.%i.log</fileNamePattern>
<!-- -->
<MaxHistory>100</MaxHistory>
<maxFileSize>4MB</maxFileSize>
<totalSizeCap>1GB</totalSizeCap>
<cleanHistoryOnStart>false</cleanHistoryOnStart>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>${PATTERN}</pattern>
</layout>
</appender>