[logback-user] How to make RollingFileAppender roll even if no log events

David Roussel nabble at diroussel.xsmail.com
Fri Aug 2 08:57:25 CEST 2013


I think this has been discussed before. Try searching the mailing list archives. 

I've got a feeling the solution was to have a app level timer that logged just after midnight to force a roll. But there may have been other solutions discussed. 

David

On 2 Aug 2013, at 05:50, David Rosenstrauch <darose at darose.net> wrote:

> Hi.  We're trying to integrate the logback framework into our app, but we're running into an issue with RollingFileAppender.
> 
> Our app is creating log files.  We are then using RollingFileAppender to periodically roll the log file, gzip it, and move it to another directory (where it subsequently gets pushed to another server for processing).
> 
> This all works fine ... as long as there's logging events happening. However, when there's no log events, the log file never rolls - which prevents it from getting moved to the other directory, and getting pushed to the other server.  So in effect, any data in the log file stays there and never gets processed.
> 
> This takes on particular importance when we want to shut a server down.  What should happen is that we stop sending the server traffic, wait till the log file rolls, and then gets pushed to the processing server - after which it's safe to shut the machine down and be assured of no log data loss.
> 
> But when we stop sending the server traffic, logback stops rolling the log too - resulting in a situation where the log data just sits in the original log file and never gets rolled, pushed, and processed.  So there's no safe time to shut the server down without loss of log data.
> 
> 
> Is there any way out of this situation?  I.e., any way to force logback to do actual clock-based rolling, rather than event-based?
> 
> Thanks,
> 
> DR
> _______________________________________________
> 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