Ilya Shishkov created IGNITE-19063:
--------------------------------------
Summary: Fix incorrect behaviour of MemorizingAppender with
MutableLogEvent
Key: IGNITE-19063
URL: https://issues.apache.org/jira/browse/IGNITE-19063
Project: Ignite
Issue Type: Test
Reporter: Ilya Shishkov
Attachments: MemorizingAppenderTest.patch
Since 2.6 version by default Log4j2 utilizes {{MutableLogEvent}} [1], which is
a reusable implementation of {{LogEvent}}.
Test Log4j2 appender {{MemorizingAppener}} in Ignite captures such events "as
is", which can lead to mutation of captured events.
Currently, it is not happened, because Log4j2 implicitly considers, that it is
initialized in web application environment, as we can see in static
initialization of Log4j2 {{ReusableLogEventFactory}} and configuration
constants and here: [2-5].
As we can see in [5], availability of {{javax.servlet.Servlet}} or
{{jakarta.servlet.Servlet}} (the first one is available in Ignite) classes is a
sufficient condition _to eliminate utilization of_ {{ReusableLogEventFactory}}.
If we turn off "web app mode" by setting up system property "log4j2.is.webapp"
to "false", than events in {{MemorizingAppener}} will be mutated after some
invocations of logger methods.
Here is a reproducer patch: [^MemorizingAppenderTest.patch]
Links:
# https://issues.apache.org/jira/browse/LOG4J2-1334
#
[https://github.com/apache/logging-log4j2/blob/e8fba8caf1ffab6dc0161f8f48611dadedb86b2c/log4j-core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java#L101]
#
[https://github.com/apache/logging-log4j2/blob/b69b7b802539d87aab6b51aca0a0df8a669ce6ee/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Constants.java#L90]
#
[https://github.com/apache/logging-log4j2/blob/c6fd104ebc14d53ea2adce9f9e6fde9a167529b4/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java#L41]
#
[https://github.com/apache/logging-log4j2/blob/c6fd104ebc14d53ea2adce9f9e6fde9a167529b4/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java#L30]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)