All, Apologies if this has been posted before.. I checked the archives but it's hard to search for such terms... lots of stuff comes up.
I have an SMTPAppender configured and it's working (mostly) as expected. The only problem is that each log message seems to generate its own separate email message. My use-case is a periodic job where I'd like to send any errors to an email box. Two configuration settings for the SMTPAppender led me to believe that the SMTPAppender might batch emails: 1. BufferSize 2. SendOnClose The javadoc specifically mentions that the BufferSize will affect the number of logging events delivered "in this email" which I assumed meant "each email message". My relevant configuration: log4j.appender.CLIENT.bufferSize=500 log4j.appender.CLIENT.sendOnClose=true Usually, we get something like 0 - 12 errors per run of this periodic job, so I wouldn't expect to get anywhere near the 500 limit. Ideally, all of those log messages would be batched together and sent when the logger shuts down. At the end of the program, I do one of these: finally { org.apache.log4j.LogManager.shutdown(); } That ought to trigger the SendOnClose behavior and flush anything that hasn't already been sent. Am I missing something in my configuration that is required to send these messages in batches? I'd prefer not to write the logs to a separate file and then use a secondary process to email that log file to the intended recipient. Thanks, -chris
signature.asc
Description: OpenPGP digital signature