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

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

    [ https://issues.apache.org/jira/browse/LOG4J2-3172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17429142#comment-17429142 ] 

Volkan Yazici commented on LOG4J2-3172:
---------------------------------------

[~barrynfleming], thanks for the bug report and elaborate investigation. Indeed copying the contents of mutable messages sounds like the way to go? Mind submitting a GitHub PR for the fix, please?

> 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
>            Priority: Major
>
> 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)