[logback-user] Daily rolling appender

Keith keithckee at gmail.com
Thu Mar 29 04:21:16 CEST 2007


I am looking to use RollingFileAppender and TimeBasedRollingPolicy to 
implement my solution of rotating logs and compressing them each day. 
The configuration looks something like that:

<configuration>
<appender name="FILE" 
class="ch.qos.logback.core.rolling.RollingFileAppender">
  <File>logFile.log</File>
  *<rollingPolicy 
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    <FileNamePattern>logFile.%d{yyyy-MM-dd}.log</FileNamePattern>
  </rollingPolicy>*

  <layout class="ch.qos.logback.classic.PatternLayout">
    <Pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern>
  </layout>
</appender>
<root>
  <level value="debug" />
  <appender-ref ref="FILE" />
</root>
</configuration>



However, I would only like to keep seven compressed daily logs only. How 
do I specify such an option in configuration file? Will I be able to use 
MaxIndex and MinIndex?

Thanks
Keith



More information about the Logback-user mailing list