Reputation: 268
I want to store current log file in /logs
folder, and all old archived .gz
files in /logs/archive
. Is there is a way to configure logback for it?
Upvotes: 1
Views: 1088
Reputation: 7330
I guess you can add rolling policy
to the appender
:
<appender name="MAIN" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_DIR}/your-app-logs.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${LOG_GZ_DIR}/your-app-logs.%d{yyyy-MM-dd}.log.gz</fileNamePattern>
<!-- keep 90 days' worth of history capped at 3GB total size -->
<maxHistory>90</maxHistory>
</rollingPolicy>
</appender>
Upvotes: 1