[logback-user] log rollover using %d multiple times in file name pattern?

ceki ceki at qos.ch
Wed Dec 21 11:39:07 CET 2011


On 21.12.2011 11:13, Thomas Corte wrote:

> That said, it could be argued that using the file name pattern for
> specifying both, file names and the rollover period, is somewhat
> convenient, but violates the principle of "separation of concerns" to
> some extent. A dedicated (optional) property to specify the rollover
> period separately may be the best solution.
> But of course it's your call.

Inferring the period from the file name pattern is less error
prone. It is impossible to specify a shorter period than what the
pattern can cater for. For example, when the period and the period are
separate, it is possible to specify daily rollover for the pattern
"%d{yyyy}.log" which would cause log archives to be clobbered on a
daily basis. Inferring the period from the pattern avoid this problem.

On the other hand, separation allows for patterns with better
prevision. For example, for a daily rollover period, you could have
%d{yyyy-MM-dd'T'HH_mm} as the pattern. I don't see such flexibility as
being useful. As such, safety trumps flexibility in this case.


-- 
Ceki
http://twitter.com/#!/ceki


More information about the Logback-user mailing list