Is it possible to set logback's configuration to create a .log file every day and keep 30 files then zip the files in one zip and start to create .log again?
You can ...
create a .log file every day and keep 30 files
... using a RollingFileAppender
with a TimeBasedRollingPolicy
. Here's an example:
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logFile.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>logFile.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- retain 30 days logs -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>...</pattern>
</encoder>
</appender>
But there is no Logback appender which will then do this:
zip the files in one zip and start to create .log again
For that you could:
Or
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With