By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,363 Members | 3,622 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,363 IT Pros & Developers. It's quick & easy.

log4j SMTPAppender -- combining messages into one e-mail?

P: n/a
Hello!

I'm trying to use log4j's SMTPAppender to get warnings and errors reported
by our application via e-mail (in addition to having ALL messages saved
into a file via RollingFileAppender).

It all works, except for one thing -- every warning/error arrives in its own
e-mail message...

The BufferSize parameters appears intended to regulate this, but no matter
what I set it to (tried different values from 1 to 102400), exactly one
log-message per e-mail are still generated...

Any ideas? Thanks!

-mi

Here is my current log4.properties file:

log4j.rootLogger=DEBUG, A1, mail
log4j.appender.A1=org.apache.log4j.RollingFileAppe nder
log4j.appender.A1.File=log.txt
log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=1

log4j.appender.A1.layout=org.apache.log4j.PatternL ayout

# Pattern to output the caller's file name and line number.
log4j.appender.A1.layout.ConversionPattern=%d %5p [%t] (%F:%L) - %m%n

log4j.appender.mail=org.apache.log4j.net.SMTPAppen der
lo***********************@example.com
lo*************************@example.com
log4j.appender.mail.SMTPHost=smtp.example.com
log4j.appender.mail.Threshold=WARN
log4j.appender.mail.BufferSize=1024000
log4j.appender.mail.Subject=Testing log4j email
log4j.appender.mail.layout=org.apache.log4j.HTMLLa yout

Feb 20 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.