Yes, I already use the OnlyOnceErrorHandler. From what I see that handler isn't for events, but for errors within the appender. I see the log4j book talking about that and using the FallbackErrorHandler to handle errors in the appenders.

Ceki G�lc� had the suggestion of using a leaky bucket in front of the appender. 
 As a test, I did accomplish that by using a custom EvaluatorClass for the 
SMTPAppender with hard-coded time comparision logic.  However, I rather like 
having the capability for a process tell log4j to simply send all queued events 
via email on demand.

Thanks for your suggestions to my problem.   BTW, JBoss wraps STDOUT and STDERR into Loggers named 
"STDOUT" and "STDERR", respectively.  If you've hooked up the normal SMTPAppender with 
it's default EvaluatorClass, you'll see an email everytime some class (badly) decides to puke out messages to 
STDERR.  I wrote a simple filter class that can filter events based on LoggerName.  I add this filter to the 
SMTPAppender configuration to drop any "STDERR" Logger events.

Best regards,
Lance
http://www.newparticles.com/


[EMAIL PROTECTED] wrote:

I was looking through Jboss-4.0.0 log4j.xml config today. And I noticed an error handler named OnlyOnceErrorHandler... Can this be a simpler solution to your problem? Is the a new Jboss 4.0.0 feature or did log4j always support it...

<appender name="SMTP" class="org.apache.log4j.net.SMTPAppender">
  <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
  <param name="Threshold" value="ERROR"/>
  <param name="To" value="xxxxxxx"/>
  <param name="From" value="JBoss"/>
  <param name="Subject" value="JBoss Sever Errors"/>
  <param name="SMTPHost" value="xxxxxx"/>
  <param name="BufferSize" value="10"/>
  <layout class="org.apache.log4j.PatternLayout">
     <param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/>
  </layout>
</appender>



Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to