is there any way i can zip the previous logs directory if exists and start fresh(creating new dir everytime system starts) in slf4j with logback.xml ?
PS: I am using java7.
Thanks
With the help of logback. Rolling policy is for that purpose. Set the retantion days and the pass for storing the zip log. MaxHistory amount of days after the file will be archived.
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/yourLog.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>../../logs/backup/yourLog_%d{yyyy-MM-dd}.log.gz</FileNamePattern>
<MaxHistory>32</MaxHistory>
</rollingPolicy>
</appender>