ppkarwasz commented on code in PR #4271:
URL: https://github.com/apache/logging-log4j2/pull/4271#discussion_r4136843704
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java:
##########
@@ -1341,18 +1338,17 @@ private static StringMap memento(final
ReadOnlyStringMap data) {
return result;
}
- private static MarshalledObject<Message> marshall(final Message msg) {
- try {
- return new MarshalledObject<>(msg);
- } catch (final Exception ex) {
- return null;
- }
- }
-
private void writeObject(final java.io.ObjectOutputStream s) throws
IOException {
this.messageString = message.getFormattedMessage();
- this.marshalledMessage = marshall(message);
s.defaultWriteObject();
+ SerializationUtil.writeWrappedObject(message, s);
Review Comment:
Nice catch! :100:
The whole point of these pesky **nested** streams is to have a fallback for
when an object is not serializable. `Message` implements `Serializable`, but it
still can have fields which are not.
Fixed in
https://github.com/apache/logging-log4j2/pull/4271/commits/b1491d70d96b677046ca5de3474924e3b16dd1a3
for `Log4jLogEvent` and other objects.
--
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]