[logback-user] Multiple log files to single archive

David Roussel nabble at diroussel.xsmail.com
Wed Oct 2 10:00:58 CEST 2013


Tom,

If you create a ticket no one is going to do the work for you as I don't think anyone else needs this functionality. If you implement it by all means pleas contribute back. I'm not a commiter, just a user.

You could start by subclassing one of the existing rolling implementations and add in your extra logic. 

It does all seem to get complicated quickly. How do you configure the archive interval? A new tag in the confg? How do you match all the older files, but not the current one etc. 

What advantage do you think you are gaining from this scheme you are suggesting?

David

> On 2 Oct 2013, at 08:35, PaSik <tompasik at poczta.fm> wrote:
> 
> I wasn't aware that Java doesn't provide any API to modify ZIP archives, that's a shake :-(
> Do you think it would be doable if the request would be to create the zip archive once at the time the archive should roll. I guess the concept of rolling should be twofold - the log files roll independently of the archives and the archives roll every n archive rolls. The moment the archive rolls all logs should be archived. 
> In case of %d{yyyy-MM-dd}.%i.zip pattern on every change of %i the next log would be created (no archiving happens at this time) and on the change of the date the rolling should happen as usual but also all the %i logs created on the previous date should be archived. 
> Do you think I can create a ticket for such a feature?
> 
> Regards,
> Tom
> 
> David Roussel <nabble at diroussel.xsmail.com> wrote:
> 
>> No that is not supported. 
>> 
>> Note that there are no java APIs (that I know of) for modifying a zip file. The only way to add a file to an existing zip file is to create a new zip file with the file added and then delete the old zip file. 
>> 
>> David
>> 
>>> On 1 Oct 2013, at 09:57, PaSik <tompasik at poczta.fm> wrote:
>>> 
>>> Hi,
>>> 
>>> Could you please tell me whether it's possible to configure logback in such a way that multiple log files are compressed to a single, possibly already existing archive (existing because logback itself has already put some log Giles in this archive).
>>> 
>>> The current use case is that I'd like to have a RollingFileAppender with SizeAndTimeBasedFNATP with fileNamePattern=mylog-%d{yyyy-MM-dd}.%i.zip and have the log files archived to mylog-%d{yyyy-MM-dd}.zip.
>>> 
>>> Another use case would be an app that doesn't produce much logs and the loga would be produced to daily files but the archives would be monthly.
>>> 
>>> Thanks,
>>> Tom
>>> _______________________________________________
>>> 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
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user


More information about the Logback-user mailing list