<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>From: L Nehring <[EMAIL PROTECTED]> Reply-To: "Log4J Users List" <[EMAIL PROTECTED]> To: Log4J Users List <[EMAIL PROTECTED]> Subject: Extension of SMTPAppender Date: Tue, 23 Nov 2004 16:59:46 -0700
I've worked out a simple extension to the SMTPAppender and I'm wondering if it's worth contributing back to log4j and how one might do that. I named the class "GatedSMTPAppender" (in a separate namespace). By default it doesn't send email based on logging events. An external process can get a reference to the appender by looking it up through the root logger and then invoking a method which sends and email of all events in the circular buffer. I wrote a very small JBoss service using the JBoss scheduler class that works very well for this in a JBoss environment.
Effectively this lets me have log4j events emailed out on a timed basis. I use an initial setting of 15 minutes for the JBoss service. What prompted me to do this was an experience I had recently where other developers released code onto a JBoss server that I monitor. They broke the installation which resulted in an "ERROR" level message getting emailed to me every 5 to 10 seconds for a span about 3 days while I was on vacation. I'm embarrassed to say that I had to clean out a little over 40,000 emails from my Inbox when I returned to work. Queuing that amount of log events into emails that get sent every 15 minutes or so is something I can better handle. If the circular buffer wraps around due to an overload, so be it - the email is just a "heads up" anyway that something needs attention.
Does this sound worthwhile enough to contribute back?
Best regards, Lance http://www.newparticles.com/ << smime.p7s >>
_________________________________________________________________
Designer Mail isn't just fun to send, it's fun to receive. Use special stationery, fonts and colors. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN� Premium right now and get the first two months FREE*.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
