SMTPAppender Class

org.apache.log4j.net.SMTPAppender

The SMTP Appender sends an email through SMTP for each logged message.

SMTPAppender JavaDoc

XML Configuration

Example configuration

This configuration will email any log message that is an error or higher.

<appender name="AdministratorEmail" class="org.apache.log4j.net.SMTPAppender">
  <param name="BufferSize" value="512" />
  <param name="SMTPHost" value="some.email.host.org" />
  <param name="From" value="appname@server.com" />
  <param name="To" value="adminA@server.com,adminB@server.com" />
  <param name="Subject" value="SomeApplication on SomeServer12" />
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern"
      value="[%d{ISO8601}]%n%n%-5p%n%n%c%n%n%m%n%n" />
  </layout>
  <filter class="org.apache.log4j.varia.LevelRangeFilter">
    <param name="LevelMin" value="error" />
    <param name="LevelMax" value="fatal" />
  </filter>
</appender>

roof repairs dublin ca

SMTPAppender (last edited 2012-10-07 17:57:19 by RalphGoers)