Details
-
Test
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
-
Docs Required, Release Notes Required
Description
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
Problem can be fixed by if we will store immutable version of events (LogEvent#toImmutable) in MemorizingAppender#append.
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
Attachments
Attachments
Issue Links
- relates to
-
IGNITE-18209 Reduce binary metadata synchronization time for CDC through Kafka
- Resolved