[logback-user] TimeBasedRollingPolicy

Jan-Olav Eide janolaveide at gmail.com
Mon Nov 4 12:07:03 CET 2013


How about :

       String activeLogFile = "a file name of your choice";
        LoggerContext loggerContext = (LoggerContext)
LoggerFactory.getILoggerFactory();
        RollingFileAppender<ILoggingEvent> appender = new
RollingFileAppender<ILoggingEvent>();
        appender.setContext(loggerContext);
        appender.setFile(activeLogFile);

        String archiveDir = "a directory of your choice"
        createIfNeeded(archiveDir);
        TimeBasedRollingPolicy<ILoggingEvent> timePolicy = new
TimeBasedRollingPolicy<ILoggingEvent>();
        timePolicy.setFileNamePattern(archiveDir +
patternFor("%d{yyyy-MM-dd,aux}/%d{yyyy-MM-dd-hh}"));  // hourly
       .....


On 4 November 2013 11:09, Per Jørgen Vigdal <Per.Jorgen.Vigdal at evry.com>wrote:

>  Hallo.****
>
> Is it possible to configure a TimeBasedRollingPolicy so that the file that
> it is being logged to does not****
>
> have any date in the filename, but the rolled over files has.****
>
> Thanks****
>
> PerJ****
>
> ** **
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20131104/a8ab60a6/attachment.html>


More information about the Logback-user mailing list