[
https://issues.apache.org/jira/browse/LOG4J2-310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13736094#comment-13736094
]
Olivier Lemasle commented on LOG4J2-310:
----------------------------------------
Hi,
I have found exactly the same bug (with Log4j2-beta8).
I tried to track down the issue, and here is what I found.
The issue is in org.apache.logging.log4j.core.net.SMTPManager, on lines 138-141:
{code:java}
final LogEvent[] priorEvents = buffer.removeAll();
if (priorEvents == null || priorEvents.length == 0) {
return; // nothing to do, another thread already took all events
}
{code}
The "prior events" are first removed from the buffer. If the error event is
the first event, there is nothing in this LogEvent array (no prior event), not
even the current event (because events are added to the buffer only if they're
filtered - see line 166 on org.apache.logging.log4j.core.appender.SMTPAppender).
Then, the condition {{(priorEvents == null || priorEvents.length == 0)}} is
true, and the mail is not sent.
> SMTPAppender does not send mails with error or fatal level without prior info
> event
> -----------------------------------------------------------------------------------
>
> Key: LOG4J2-310
> URL: https://issues.apache.org/jira/browse/LOG4J2-310
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders, Filters
> Affects Versions: 2.0-beta7
> Environment: - Ubuntu Linux 12.04
> - java version "1.6.0_27"
> - OpenJDK Runtime Environment (IcedTea6 1.12.5) (6b27-1.12.5-0ubuntu0.12.04.1)
> - OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
> Reporter: Jost Waldmann
>
> When using an SMTPAppender a mail is only delivered on a fatal event if there
> occured an info event before.
> Prior fatal events are ignored by SMTPAppender - other Appenders log them.
> A more detailed explanation/discussion including an example program can be
> found at:
> http://stackoverflow.com/questions/17657983/log4j2-smtpappender-does-not-send-mails-with-error-or-fatal-level
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]