ppkarwasz commented on code in PR #2815:
URL: https://github.com/apache/logging-log4j2/pull/2815#discussion_r1711337481
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/jackson/Initializers.java:
##########
@@ -62,33 +65,43 @@ void setupModule(
: ThrowableProxyWithoutStacktraceMixIn.class);
}
}
+ /**
+ * Used to set up {@link SetupContext} from different {@link
SimpleModule}s.
+ * <p>
+ * Serializes the context map as list of objects.
+ * </p>
+ */
+ static class SetupContextAsEntryListInitializer extends
AbstractInitializer {
+
+ @Override
+ void setupModule(
+ final SetupContext context, final boolean includeStacktrace,
final boolean stacktraceAsString) {
+ super.setupModule(context, includeStacktrace, stacktraceAsString);
+ // Prevents reflective JPMS access
+ // https://github.com/apache/logging-log4j2/issues/2814
+ context.addSerializers(new SimpleSerializers(singletonList(new
ContextDataAsEntryListSerializer())));
+ context.addDeserializers(
+ new SimpleDeserializers(singletonMap(StringMap.class, new
ContextDataAsEntryListDeserializer())));
Review Comment:
Fixed in
https://github.com/apache/logging-log4j2/pull/2815/commits/0b8c1955765d47fa978012b4c1b3b101169e88fe
Note that I don't have any idea what the best practices for encapsulating
classes related to Jackson are.
I am merely trying to maintain the spirit of the original authors.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]