SMTPAppender buffer flushed on exit?

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

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. HTH, 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
participants (2)
-
Ceki Gülcü
-
Mark Woon