[slf4j-user] Serializable log adapters

Ceki Gülcü listid at qos.ch
Tue Mar 13 22:05:56 CET 2007


At 06:41 AM 3/13/2007, Trustin Lee wrote:

>Implementing readResolve() for every class with a logger field is 
>painful.  Would there be any easier way?  Of course, the easiest solution 
>is not to use logger for serializable objects, which might make sense.

Assuming the serialized object (once transmitted to the remote host) does 
not need to log (while located on the remote host), there are two options.

1) You could mark the member variable referring to org.slf4j.Logger as 
"transient".
2) We could have org.slf4j.Logger extend java.io.Serializable.

Option 1 is relatively easy to do, as long as you have access to the source 
code. Option 2, would also be very easy to accomplish, except that it gives 
the (wrong) impression that a serialized logger can serve a meaningful 
purpose, which unless you go into violent readResolve() contortions, it 
does not.

Let us see if we get other complaints about this issue. If not, I am 
inclined to think that we leave things as is.

>Trustin

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch




More information about the slf4j-user mailing list