I'm trying to configure logs rolling policy for a java web application. Here is what I have so far
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/appLog.%d{yyyy-MM-dd HH}.%i.log.gz
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>500MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>7</maxHistory>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
What I'm trying to achieve here is to keep all the logs for the past 7 days, but compress log files whenever they reach 500MB.
Logback configuration shown above keeps only last 7 files, so if there are lot of logs, I can have 7 files only for the last day, for example.
How can I configure logback in this case to keep all logs for the past 7 days? Any help is really appreciated.