[logback-user] Main roller: FixedWindowRollingPolicy; trigger: TimeBasedRollingPolicy

Troy Hart troy.hart at gmail.com
Wed Dec 11 16:05:09 CET 2013

<appender name="default"
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    <encoder class="${logging.encoder.default}" />

The configuration above uses runtime properties (property name wrapped
in ${}) so you can just fill in the values with whatever you can
imagine. This configuration rolls the file every night at mid-night
(you'd need to look at the documentation of SizeAndTimeBasedFNATP to
see how to do it at 4am rather than mid-night--I think it's possible).
The nice thing about this policy is that not only rolls on a time
schedule (as dictated by the date stamp format), but it also rolls
when the file gets too large (maxFileSize).

Hope this helps!


On Wed, Dec 11, 2013 at 7:32 AM, Felipe <felipenaranja at gmail.com> wrote:
> Hey friends! Greetings from Chile.
> I'd like to achieve the following:
> I want my main rollingPolicy to be FixedWindowRollingPolicy. This way, my
> main logging file will always be named the same way and backup files will by
> rolling.
> I want the triggeringPolicy to be TimeBasedRollingPolicy, so it rolls every
> day at 04:00 AM. I couldn't find a way to achieve this and I only saw
> examples of SizeBasedTriggeringPolicy, which is not my desired
> triggeringPolicy. I couldn't find a parameter for TimeBasedRollingPolicy and
> besides of that it seems to require fileNamePattern.
> Is there any way to achieve this? Thanks in advance!
> Best regards.
> --
> Felipe
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user

More information about the Logback-user mailing list