[logback-user] problems with TimeBasedRollingPolicy

Ceki Gülcü ceki at qos.ch
Fri Jul 1 12:14:28 CEST 2011


Hi Alex,

The default implementation of  TimeBasedFileNamingAndTriggeringPolicy 
i.e. DefaultTimeBasedFileNamingAndTriggeringPolicy remembers the date of 
the latest logging activity prior to the current logging activity 
triggering roll over. This is the date which will be used for naming the 
target file for the rollover. When rollover occurs immediately due to 
application restart, it is the date of the existing log file which is 
saved into memory.

HTH,


On 01/07/2011 10:38 AM, Alex Vb wrote:
> Good to know :) Just out of curiosity, how is this accomplished? Do you
> look at the created/updated timestamp? Do you look in the log file for
> dates? Or another method?
>
> On 1 July 2011 09:36, Ceki Gülcü <ceki at qos.ch <mailto:ceki at qos.ch>> wrote:
>
>     On 01/07/2011 9:08 AM, Alex Vb wrote:
>
>         I may have missed something but is there a specific reason you
>         can't use
>         the date in the filename itself?
>
>         My only concern would be what happens if you don't log for a
>         day, the
>         first log will trigger a roll but the rolled file may be dated
>         incorrectly? Anyway if that is the case you can use prudent (or
>         something equivalent) which doesn't actually rename the files
>         but writes
>         to the actual target file with date and all.
>
>
>     The file will be dated correctly even it it is rolled over in the
>     next day.
>



-- 
QOS.ch, main sponsor of cal10n, logback and slf4j open source projects, 
is looking to hire talented software developers. For further details, 
see http://logback.qos.ch/job.html


More information about the Logback-user mailing list