Sunday, September 18, 2011

org.apache.log4j.net.SMTPAppender

there is a lovely way to send an alert by email using log4j:
just create an appender email of type SMTPAppender:


log4j.appender.email=org.apache.log4j.net.SMTPAppender
log4j.appender.email.SMTPHost=mailgateway.mycompany.com
log4j.appender.email.BufferSize=128
log4j.appender.email.To=myself@rabiddog.com
log4j.appender.email.Subject=My Subject Here
log4j.appender.email.layout=org.apache.log4j.HTMLLayout
log4j.appender.email.layout.ConversionPattern= [%t]: %m%n

No comments: