[logback-user] Log rollover: activate based on size but keep "creation date" in file name?

ceki ceki at qos.ch
Fri Jun 8 21:57:11 CEST 2012


Hi Yura,

Have you tried auxiliary timestamps in fileNamePattern? For example,

   %d{yyyy-MM-dd}-%d{HHmm,aux}.%{i},log

The primary date token, %d{yyyy-MM-dd}, determines roll over period,
i.e. 24 hours, where the auxiliary pattern, %d{HHmm,aux} contributes
to the file name of the archived log files.

For more details, refer to docs on TimeBasedRollingPolicy's
fileNamePattern [1].

HTH,

[1] http://logback.qos.ch/manual/appenders.html#TimeBasedRollingPolicy

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

On 08.06.2012 20:12, Yura Levandovskyy wrote:
> Hello,
>
> I'm trying to configure a naming scheme that would result in longs in
> the format of %d{yyyy-MM-dd-HHmm}.%i.log, however the time should
> indicate log creation time, not current time.
>
> New log is created in 2 situations: on application launch
> <rolloverOnStart>true</rolloverOnStart> or <maxFileSize>1MB</maxFileSize>.
>
> However, because of the naming format, the log gets put in a different
> location every minute. Is there a way to only set the log name on
> creation and then write to it until next rollover?
>
> Thank you
>
>



More information about the Logback-user mailing list