Hi all,

I'd like to report 2 problems I am encountering using the SMTPAppender. I
am using it* to send me mails whenever an ERROR is logged in a web
application.

1) Buffer size is ignored. Excerpt from my log4j2.xml:
<SMTP name="Mail" suppressExceptions="false" subject="Error Log"
to="..." from="..." smtpHost="smtp.gmail.com"
 smtpPort="465" *bufferSize="10"* smtpProtocol="smtps" smtpUsername="..."
smtpPassword="...">
 </SMTP>

You will notice that the buffer size is 10. I'd expect to be getting
e-mails with 10 errors aggregated, but every e-mail always contains only
one error.

Looking into SMTPAppender.append() I see a call to manager.sendEvents()
which does not aggregate the message - it just sends it. To me it seems
that append() should write into SMTPManager.buffer and send only if it's
full...

2) Sending the e-mail blocks the thread that logged the error. I don't know
how to "prove" this empirically, it's just a really clear subjective
feeling: whenever an error gets logged, the whole application just lags for
the time it takes to send the mail.

Can I provide you some help in pinpointing this problem?


Overall: just ask if you need more information,


Thanks!


Matej

Reply via email to