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

Yura Levandovskyy liova_89 at yahoo.ca
Mon Jun 11 18:48:57 CEST 2012


Thank you for the suggestion

I've tried it, and it seems to set the aux part on application launch, but not on new log creation. So, specifically, right now I get:

2012-06-11.1201.1.log (creation time 12:01, application launched)
2012-06-11.1201.2.log (creation time e.g. 12:05, rollover due to size)
2012-06-11.1201.3.log (creation time e.g. 12:10, rollover due to size)


What I'm trying to achieve is the following:

2012-06-11.1201.1.log (creation time 12:01, application launched)
2012-06-11.1205.2.log (creation time e.g. 12:05, rollover due to size)
2012-06-11.1210.3.log (creation time e.g. 12:10, rollover due to size)

The rollover, according to policies in effect, occurs on log size or every day. 
What could be the issue here?


________________________________
 From: ceki <ceki at qos.ch>
To: logback users list <logback-user at qos.ch> 
Sent: Friday, June 8, 2012 3:57:11 PM
Subject: Re: [logback-user] Log rollover: activate based on size but keep "creation date" in file name?
 
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
>
>

_______________________________________________
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/20120611/32005811/attachment.html>


More information about the Logback-user mailing list