Closed
Description
When running on JDK 9+ the StackTraceElement
class has three additional fields: classLoaderName
, moduleName
and moduleVersion
.
These fields:
- are not used in the stack trace formatter, so stack traces formatted by Log4j differ from
StackTraceElement.toString()
, - are lost during serialization of
ExtendedStackTraceElement
, so a deserialized element differs from the original, - are automatically serialized by Jackson, when serializing an event's location. Such an event can not be deserialized.
These problems amount to the majority of test failures under JDK 11. This blocks #1369.
An example of serialized event:
<Event xmlns="http://logging.apache.org/log4j/2.0/events" timeMillis="1690783320311" thread="main" level="INFO" loggerName="eu.copernik.log4j.test.XmlTest" endOfBatch="false" loggerFqcn="org.apache.logging.log4j.spi.AbstractLogger" threadId="1" threadPriority="5">
<Instant epochSecond="1690783320" nanoOfSecond="311415800"/>
<Message>Hello world!</Message>
<Source class="eu.copernik.log4j.test.XmlTest" method="main" file="XmlTest.java" line="14">
<classLoaderName xmlns="">app</classLoaderName>
<moduleName xmlns="">eu.copernik.log4j.test</moduleName>
<moduleVersion xmlns="">1.0.0</moduleVersion>
</Source>
<Thrown commonElementCount="0" name="java.lang.RuntimeException">
<ExtendedStackTrace>
<ExtendedStackTraceItem class="eu.copernik.log4j.test.XmlTest" method="main" file="XmlTest.java" line="13" exact="true" location="classes/" version="?"/>
</ExtendedStackTrace>
</Thrown>
</Event>