Damn...Oops...Just discovered that someone already did it(SMTPAppender).
( Oh well, sorry for the post, and please ignore previous comments.
Jesse
----- Original Message -----
From: "Jesse Kuhnert" <[EMAIL PROTECTED]>
To: "LOG4J Developers Mailing List" <[EMAIL PROTECTED]>
Sent: Saturday, July 07, 2001 8:11 PM
Subject: e-mail Appender?
> I've created a little e-mail appender that sends e-mail out to a
> specific/series of e-mail addresses depending on the log-level. (We get
all
> error/fatal). I'm not sure if anyone is interested in something like this,
> because in most cases it would probably be more like spam than help. :) We
> have to maintain our product after we release it, so this just makes it
much
> easier than asking a DFU what is going on.
>
> The code is a little dirty, but I can clean it all up if you guys want it.
> (I think maybe the SendMail methods don't need to be synchronized, only
the
> init...) It uses Sun's JavaMail api as the underlying mechanism for
sending
> the mail. Not sure where I should post the files, I'll attach the two Java
> files, and post the log4j xml config used below.
>
> btw, Log4j kicks ass! (Although more/any appender creation documentation
> would've been helpful...I can create a small one if you guys think it's
> helpful, although my ~wordy~ skills are not quite up to par with my
coding.
> :).
>
> Jesse
>
> ============================================
> Sample log4j xml file configuration(the one we use)
> ============================================
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
>
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
>
> <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
> <appender-ref ref="MAIL"/>
> </appender>
>
> <appender name="MAIL" class="com.frontiers.server.mail.MailAppender">
> <param name="Threshold" value="ERROR" />
>
> <param name="To" value="[EMAIL PROTECTED] ,
> [EMAIL PROTECTED], [EMAIL PROTECTED]" />
> <param name="Subject" value="Error from CaseServer!!" />
> <param name="From" value="[EMAIL PROTECTED]" />
> <param name="Location" value="CaseServer at X company. I.P. address:
> 10.1.1.44" />
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern" value="%d{ISO8601}
%-5p
> %c{1} - %m%n"/>
> </layout>
> </appender>
>
> <appender name="A1"
> class="org.apache.log4j.DailyRollingFileAppender">
> <param name="File" value="./log/appserver.log" />
> <param name="Append" value="true" />
> <param name="DatePattern" value="'.'dd" />
>
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern" value="%d{ISO8601} %-5p
> %c{1} - %m%n"/>
> </layout>
>
> <filter class="org.apache.log4j.varia.PriorityRangeFilter">
> <param name="PriorityMin" value="DEBUG" />
> <param name="PriorityMax" value="WARN" />
> <param name="AcceptOnMatch" value="true" />
> </filter>
> </appender>
>
> <appender name="A2"
> class="org.apache.log4j.DailyRollingFileAppender">
> <param name="File" value="./log/error.log" />
> <param name="Append" value="true" />
> <param name="DatePattern" value="'.'dd" />
> <param name="Threshold" value="ERROR" />
>
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern" value="%d{ISO8601}
%-5p
> %c{1} - %m%n"/>
> </layout>
> </appender>
>
> <root>
> <priority value ="debug" />
> <appender-ref ref="A1" />
> <appender-ref ref="A2" />
> <appender-ref ref="ASYNC"/>
> </root>
> </log4j:configuration>
>
>
----------------------------------------------------------------------------
----
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]