Skip to content

Conversation

@jeffrey-aguilera
Copy link

I verified that this works for StrictLogging using the Kryo serializer; but it does not work using the Java serializer. See my comments on #26

Because the test uses Kryo, I did not add it to the commit.

@analytically
Copy link
Collaborator

What's the best approach using the Java serializer? Can you test using private def readObject(in: java.io.ObjectInputStream)? See http://stackoverflow.com/questions/82109/should-a-log4j-logger-be-declared-as-transient

@jeffrey-aguilera
Copy link
Author

There is also this comment by Ceki: "Contrary to static variables, instance variables are serialized by default. As of SLF4J version 1.5.3, logger instances survive serialization. Thus, serialization of the host class no longer requires any special action, even when loggers are declared as instance variables. In previous versions, logger instances needed to be declared as transient in the host class" at http://www.slf4j.org/faq.html#declared_static. This seems inconsistent with observations.

@orium orium mentioned this pull request Feb 13, 2016
@analytically
Copy link
Collaborator

How does this impact #52, @orium?

@orium
Copy link
Contributor

orium commented Feb 18, 2016

Making the log serializable is an alternative of having it transient. The problem with making it transient is that on deserialization you will have a null logger and a NPE when you use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants