Here's my config:
<appender name="myAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
<append>true</append>
<file>mylogs.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>mylogs-%d{yyyy-MM-dd_HH-mm}.log</fileNamePattern>
<!-- keep 30 days' worth of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} [%thread] - %M:%L - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
</appender>
According to the logback's document found here TimeBasedRollingPolicy , file will be rollover every minute based on my %d{yyyy-MM-dd_HH-mm}
fileNamePattern.
I observed how this works and here are my findings:
- It doesn't create a log file very minute.
- It only create a log file for the previous minute when the a new log arrives. (e.g. I have a log on 11:53pm, and it's now 11:55pm, it doesn't create a new log file immediately for the 11:53pm when it hits 11:54pm, but when a new log came later, say at 11:56pm, it now creates the file for 11:53pm.)
Am I missing something, I thought it will create a log file every minute?