You are looking for the RollingFile appender
<RollingFile name="DAILY_LOG" fileName="log/daily.log"
filePattern="log/%d{ddMMyyyy}_daily.log"
>
<PatternLayout pattern="%d [%7r] %5p - %c - %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1"/>
</Policies>
</RollingFile>
The previous sample rolls over by day, the interval being 1 unit which is determined by the smallest unit of the date lookup in the file pattern. In other words if the date pattern was d{MMyyyy}
,then the interval=1 corresponds to a rollover period of 1 month.
Please note there currently is no support for limiting the number of log files kept past a certain date or age etc. You can only limit the number of log files per time period.