A typical logback appender configuration is
<appender name="NAME"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>FILEPATH.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>FILEPATH.%d{yyyy-MM-dd-HH}.log</fileNamePattern>
<maxHistory>24</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
Usually it works fine to me. But I found that it will not split log file as the rollingPolicy specified when there's no log appended to the logger respected.
Please tell me How I can configure it to split log file for every hours even there's no log record for some hours. If there's no log record for any hour, I need logback to create an empty file for that hour.