[logback-user] Multiple date patterns in filename pattern

Ralph Goers rgoers at apache.org
Tue Feb 28 19:21:02 CET 2012


See http://jira.qos.ch/browse/LBCORE-242. I believe I saw commits that said Ceki implemented something.

Ralph

On Feb 28, 2012, at 8:52 AM, Chris Pratt <thechrispratt at gmail.com> wrote:

> I haven't tried this at all, but have you tried:
> 
> /logs/%d{yyyy}/%d{MM}/app.%d{yyyyMMdd}.log 
> 
> Maybe it's the directory separator in the format string that was confusing it.
>   (*Chris*)
> 
> On Tue, Feb 28, 2012 at 8:42 AM, Chris Lemper <clemper at verical.com> wrote:
> Hi Logback users!
> 
> I would like to store daily log files in the format:
> 
> /logs/%d{yyyy/MM}/app.%d{yyyyMMdd}.log
> 
> So that the end result is:
> 
> /logs/2012/02/app.20120228.log
> 
> That is I would like all daily log files for a given month in a single directory but each log file containing the full date.
> 
> However, when I configure this filename pattern using ch.qos.logback.core.rolling.TimeBasedRollingPolicy, logback bases the rolling policy only on the first pattern:
> 
>  INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyy/MM' from file name pattern '/logs/%d{yyyy/MM}/app.%d{yyyyMMdd}.log'.
>  INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Rollover at start of every month.
> 
> Is it possible to accomplish this, even by just forcing the rollover to be daily (at midnight) independent of the filename pattern?  I have looked through the mailing lists, documentation, and source code and cannot figure out how or if it can be done.
> 
> Thanks,
> Chris Lemper
> 
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
> 
> _______________________________________________
> 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/20120228/c1e6921a/attachment.html>


More information about the Logback-user mailing list