title: Is it possible to buffer output to Log4j Mail Appender?
body: <p>In many service applications where log4j is used in combination with a mail appender as such ..</p>
  
  <pre><code>log4j.rootLogger=ERROR, MAIL
  log4j.appender.MAIL=org.apache.log4j.net.SMTPAppender
  log4j.appender.MAIL.BufferSize=1
  log4j.appender.MAIL.SMTPHost=smtp.example.com
  log4j.appender.MAIL.From=noreply@example.com
  log4j.appender.MAIL.To=developer@example.com
  log4j.appender.MAIL.Subject=Exception
  log4j.appender.MAIL.layout=org.apache.log4j.PatternLayout
  log4j.appender.MAIL.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5r %-5p [%t] %c{2} - %m%n
  </code></pre>
  
  <p>.. the probability for several exceptions of the same type to occur, and possibly continuing until an issue is resolved is very high.</p>
  
  <p>Is there a way of buffering output so that mails are only sent within given time intervals?</p>
  
  <p>A nice solution would be to group exceptions on type and class it occurred in, but simply appending to a local log and sending a rolled log over timed intervals would suffice. The idea is to not receive hundreds or thousands of error reports from a stressed system, but rather receive vital information in time, and then not be bothered about the subsequent actions.</p>
  
  <p>Is there a solution without implementing a <code>TriggeringEventEvaluator</code>?</p>