Re: Two problems with SMTPAppender

2013-05-10 Thread Matej Vitásek
Remko, Thanks for the answer. After looking into the sources some more I found this: - SMTPAppender.append(), which seems to be the usual way of events being logged to this appender, sends the mail directly. - SMTPAppender.isFiltered(), which is an overriding of the usual logic

Re: Two problems with SMTPAppender

2013-05-10 Thread Remko Popma
Matej, Suppose you have 3 threads that all log an error at exactly the same time. They all call isFiltered at the same time, and all events are added to the buffer before any thread had a chance to call the append method. Now all three threads will call the append method. The first time, 3

Re: Two problems with SMTPAppender

2013-05-10 Thread Matej Vitásek
Thanks Remko, I understand it much better now. However, this one still eludes me: if you look into AppenderControl.callAppender(), there is a line like this: if (appender instanceof Filterable ((Filterable) appender).isFiltered(event)) { return; } If I

Re: Two problems with SMTPAppender

2013-05-10 Thread Ralph Goers
Your understanding is correct. The intention is to include the last n log events in the email when an error occurs, regardless of their log level. This is often useful for debugging. I believe this behavior carried over from either log4j 1.x or logback - I'm not really sure since someone else

Two problems with SMTPAppender

2013-05-09 Thread Matej Vitásek
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=...

Re: Two problems with SMTPAppender

2013-05-09 Thread Remko Popma
Matej, The docs may not be clear on this, but i believe this buffer is essentially for multithreaded access. Every event will be stored in the buffer, and then trigger a send(). You are right that sending happens in the calling thread. You could consider wrapping the smtp appender in an