You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Barry Fleming (Jira)" <ji...@apache.org> on 2021/10/11 21:13:00 UTC

[jira] [Created] (LOG4J2-3172) SmtpManager sends emails with OFF level messages

Barry Fleming created LOG4J2-3172:
-------------------------------------

             Summary: SmtpManager sends emails with OFF level messages
                 Key: LOG4J2-3172
                 URL: https://issues.apache.org/jira/browse/LOG4J2-3172
             Project: Log4j 2
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 2.14.1
            Reporter: Barry Fleming


I occasionally receive emails with logs that have OFF level and no message when using <SMTP> with a filter and the setting -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector.

I believe the cause is that AsyncLoggerContextSelector uses RingBufferLogEvents, and when the filter matches these events are buffered by the SmtpManager and then cleared soon after by the RingBufferLogEventHandler. Once the SmtpManager's buffer has filled, the empty events are added to the email.

There is logic in SmtpManager.add(LogEvent) to copy the contents of mutable messages, and it might be appropriate to do the same for RingBufferLogEvents.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)