Geeks With Blogs
Sean Carpenter Thoughts on Development

Log4j includes an SMTP appender that can be used to send logging messages via email. As of log4j 1.2.16, this built-in appender has the ability to send messages via Gmail.

Here is an example log4j configuration that uses Gmail to send logged messages:

log4j.rootLogger=DEBUG, gmail Message via Gmail{MM/dd/yyyy HH:mm:ss} [%M] %-5p %C - %m%n

The SMTPUsername, SMTPPassword, Subject, To, and From properties should be replaced with values appropriate for your situation. One thing that tripped me up originally is that the SMTPPort should be set to 465, not 587 as I had originally done.

Posted on Friday, November 26, 2010 3:03 PM | Back to top

Comments on this post: Gmail Logging with log4j 1.2.16

Comments are closed.
Comments have been closed on this topic.
Copyright © Sean Carpenter | Powered by: