public
Description: Support SSL transport in SMTPAppender - Useful for mail notification via gmail
Home | Edit | New

Home

log4j-1.2.15-ssl-patch

Why?

There hasn’t been any major release of log4j since 2007.

SSL et TLS support don’t exist in log4j 1.2.15

I wanted to use gmail to send log4j notification mails.

The patch is available and already in log4j trunk (https://issues.apache.org/bugzilla/show_bug.cgi?id=25355) but I don’t want to wait for a release to be done.

So I forked Log4j 1.2.15 just to add the ssl/tls support to send mail with gmail.

Differences between official and this version

Just gmail support.

I hacked some ant/pom files but just to make the build less painfull ;)

Anyway, you can look at gihub history so see what I changed…

Download

Just go to the Downloads section of this project.

Usage

Same as usual SMTPAppender but with extra properties:


log4j.rootLogger=DEBUG, EMAIL

# EMAIL
log4j.appender.EMAIL=org.apache.log4j.net.SMTPAppender
log4j.appender.EMAIL.SMTPHost=smtp.googlemail.com
log4j.appender.EMAIL.SMTPProtocol=smtp # NEW
log4j.appender.EMAIL.SMTPPort=587 # NEW
log4j.appender.EMAIL.StartTls=true # NEW
log4j.appender.EMAIL.From=MY_ACCOUNT@gmail.com
log4j.appender.EMAIL.To=MY_ACCOUNT@sqli.com
log4j.appender.EMAIL.SMTPUsername=MY_ACCOUNT@gmail.com
log4j.appender.EMAIL.SMTPPassword=MY_PASSWORD
log4j.appender.EMAIL.Subject=Test Gmail Smtp
log4j.appender.EMAIL.layout=org.apache.log4j.PatternLayout
log4j.appender.EMAIL.layout.ConversionPattern=[%d] [%t] %-5p %c %x - %m%n
# log4j.appender.EMAIL.Threshold=ERROR
log4j.appender.EMAIL.BufferSize=1
# log4j.appender.EMAIL.SMTPDebug=true

License

I don’t care ;)

Let’s say Apache v2.

Last edited by francisoud, Thu Mar 05 08:28:49 -0800 2009
Home | Edit | New
Versions: