[logback-user] how to graceful shutdown logback with AsyncAppenders and without immediateFlush

Michael Reinhold mike at coursescheduler.io
Fri Mar 21 12:55:47 CET 2014

Hi Gena,

I agree - a solid implementation of a fail-safe transparent sync mode could
be the default as it will likely cover most scenarios.

Once my pull request is merged into Logback, I would be interested in
working with you on the implementation of such a switch to fail-safe mode.
At the very least, I could assist with testing since my application has
similar requirements and characteristics.

As always, thank you for the great discussion! Let me know if you would
like assistance working on this in the future!


Mike Reinhold

On Fri, Mar 21, 2014 at 7:44 AM, Gena Makhomed <gmm at csdoc.com> wrote:

> On 20.03.2014 22:35, Michael Reinhold wrote:
>  The intent of the shutdown hook functionality is not to be a general
>> application shutdown hook, but to provide reasonably ways of having
>> logback wait for a some condition before shutting down (not just calling
>> LoggerContext.stop immediately). Logback can provide one or more general
>> mechanisms for performing this action, however if the user's needs
>> differ they could implement their own.
> Ok. Most likely you are right, such approach is useful for flexibility.
> Particularly if exotic appenders are used, like cloud logging services.
> And user can select how logback should react to system-wide message
> "JVM will be shutdown soon" - by completely shutting down logback
> or just by flushing all memory buffers and switching logback
> info fail-safe mode and continue logging.
> I prefer switching into fail-safe transparent sync mode
> to be the default, which guarantee flushing all events
> from memory buffers and also allow subsequent events
> from other components of system not to be lost
> during JVM shutdown sequence.
> And only in very exotic situations such default behavior
> should be changed by user manually into something else.
> Thank you for the good discussion!
> --
> Best regards,
>  Gena
> _______________________________________________
> 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/20140321/3e058eeb/attachment.html>

More information about the Logback-user mailing list