Jul 23

Log4j comes with an appender that will send an email when a logging event occurs. The appender class is org.apache.log4j.net.SMTPAppender and the following gives an example of its configuration

<appender name="LogEmail" class="org.apache.log4j.net.SMTPAppender">
  <param name="BufferSize" value="512" />
  <param name="SMTPHost" value="mail.server.com" />
  <param name="From" value="myapp@server.com" />
  <param name="To" value="support@server.com" />
  <param name="Subject" value="Log from myapp" />
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern"
      value="%p %t %c - %m%n" />

written by objects \\ tags: , ,

Leave a Reply

You must be logged in to post a comment.