Hi Gena,
Thank you for your suggestion - it always appreciated to have additional input into a design.
In my opinion, the solution that Ceki and I have been working on is somewhat simpler and probably easier to implement. The full conversation can be viewed in the pull request comments, but basically we have settled on a small alteration to AsyncAppenderBase in Logback-core that makes the worker.join(long) call have a configurable timeout instead of hardcoded to 1000ms. By doing this, LoggerContext.stop is now guaranteed to flush as many queued events as possible within the specified timeout - which can be tuned via the maxShutdownTime configuration element for AsyncAppender. Additionally, since the maxShutdownTime configuration element has the same semantics as Thread.join(long), using a value of 0 will cause the LoggerContext.stop method to wait for all queued events to flush regardless of how long it takes. This solution is better in my mind because it involves very few code changes and does not alter shutdown semantics for any existing users (no additional calls to change the Logback mode), while still making it possible for AsyncAppender to fully flush its queue by adjusting the timeout.
The second piece of the design that we have been working on is how to allow for flushing the queue when it is not possible to call LoggerContext.stop prior to application exit (such as when an application exits implicitly or from) or when shutdown hooks expect the ability to log events. This is a little more complex, but per Ceki's description in the pull request comments, adding a new action to Joran to allow the installation of a shutdown hook that calls LoggerContext.stop is pretty flexible.
Regards,
Mike Reinhold