makkimesser opened a new issue, #1884: URL: https://github.com/apache/logging-log4j2/issues/1884
## Description Since 2.21.0 serializing a Logger raises java.io.NotSerializableException. Maybe this is caused by this commit (see my comment on commit): https://github.com/apache/logging-log4j2/commit/e86d28bdb927f8047b924eb459f4c63bd2e43176 ## Configuration **Version:** 2.21.0 **Operating system:** Windows-10 **JDK:** OpenJDK 1.8.0_382 ## Logs ``` Exception in thread "main" java.io.NotSerializableException: java.lang.ThreadLocal at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) at test.TestSerializeLogger.main(TestSerializeLogger.java:14) ``` ## Reproduction ``` package test; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @SuppressWarnings("javadoc") public class TestSerializeLogger { public static void main(final String... args) throws IOException { try (ObjectOutputStream objOut = new ObjectOutputStream(new ByteArrayOutputStream())) { Logger logger = LogManager.getLogger("Test"); objOut.writeObject(logger); } } } ``` -- 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]
