[logback-user] SMTPAppender buffer flushed on exit?

Ceki Gülcü ceki at qos.ch
Tue Sep 20 22:00:55 CEST 2011

Hi Mark,

Assuming SMTPAppender is configured with OnErrorEvaluator (the default), 
then an email will be sent each time a logging event with the ERROR 
level occurs.  You can cause such an event to occur on system exit by 
registering a shutdown hook. See Runtime.addShutdownHook.


On 20/09/2011 9:54 PM, Mark Woon wrote:
> Is there a way to get the SMTPAppender to flush/send its buffer before
> the system exits?
> If I've a buffer of 64 and my program exits, it doesn't seem to be
> sending out what's in the queue.  Is there a way to either configure it
> to flush before the program exits or a hook I can call to trigger it?
> Thanks,
> -Mark

QOS.ch, main sponsor of cal10n, logback and slf4j open source projects, 
is looking to hire talented software developers. For further details, 
see http://logback.qos.ch/job.html

More information about the Logback-user mailing list