Log4j SMTPAppender

Add to classpath

  • mail.jar
  • activation.jar

Add to log4j.properties
log4j.appender.EMail=org.apache.log4j.net.SMTPAppender
log4j.appender.EMail.From=sender@aceme.com
log4j.appender.EMail.SMTPHost=smtp.aceme.com
log4j.appender.EMail.Subject=Test
log4j.appender.EMail.To=receiver@aceme.com
log4j.appender.EMail.layout=org.apache.log4j.PatternLayout
log4j.appender.EMail.layout.ConversionPattern
=%p %d{dd/MM/yyyy HH:mm:ss} %F %L %m%n

This entry was posted in java. Bookmark the permalink.