[slf4j-dev] [Bug 71] JCL loggers are Serializable, jcl104-over-slf4j logger is not
bugzilla-daemon at pixie.qos.ch
bugzilla-daemon at pixie.qos.ch
Wed Jul 30 17:40:55 CEST 2008
http://bugzilla.slf4j.org/show_bug.cgi?id=71
listid at qos.ch changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |ASSIGNED
------- Comment #3 from listid at qos.ch 2008-07-30 17:40 -------
Manfred,
I am not following. Transient references are not serialized. So by
construction, after serialization they are null. Would it be possible
for you to supply a test case showing how code relying on SLF4J
loggers fails while code relying on JCL loggers would not?
The following code may be start:
package org.slf4j;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import junit.framework.TestCase;
public class SerializationTest extends TestCase {
public void testSmoke() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
Logger logger = LoggerFactory.getLogger("x");
Apple apple = new Apple();
apple.setLogger(logger);
oos.writeObject(apple);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bais);
Apple apple2= (Apple) ois.readObject();
}
}
package org.slf4j;
import java.io.Serializable;
public class Apple implements Serializable {
private static final long serialVersionUID = 1L;
transient Logger logger;
void setLogger(Logger logger) {
this.logger = logger;
}
void doIt() {
logger.debug("hello");
}
}
--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the slf4j-dev
mailing list