https://issues.apache.org/bugzilla/show_bug.cgi?id=46404
--- Comment #6 from Hanno Neuer <[email protected]> 2009-02-26 00:22:03 PST --- My further analysis: The problem is not related to bug 44038 and exists not only for Exceptions but for all Objects. Assume the following lines and a SocketAppender configuration: logger.debug(new Object() { public String toString() { Logger.getLogger(Object.class).debug("Will not go through the wire"); return "Will not go through the wire neither!"; } }); The problem is in SocketAppender#append(LoggingEvent) in combination with the LoggingEvent serialization. SocketAppender#append(LoggingEvent) will call ObjectOutputStream#writeObject with the given LoggingEvent. In ObjectOutputStream#writeObject the underlying OutputStream will be prepared and then at some point LoggingEvent#writeObject(ObjectOutputStream) will be called. In LoggingEvent#writeObject(ObjectOutputStream) there are a few lines preparing the non-transient fields of LoggingEvent, e.g. getRenderedMessage and getThrowableStrRep. Those methods make calls to the Object and Throwable to be logged which are not restricted in anyway. And that's the crux of the matter, they can even have their own logging! If now the Object to be logged (as in the above example) calls the Logger again, it will try to send a second LoggingEvent through the wire using the same ObjectOutputStream, allthough the ObjectOutputStream is currently used to write the first LoggingEvent. This results in: log4j:WARN Detected problem with connection: java.io.IOException: stream active A possible solution to handle this situation is to make sure, that the LoggingEvent will not make any calls to the logged Objects while serialization (e.g. by preparing the LoggingEvent _before_ ObjectOutputStream#writeObject is called). I hope this clarifies my problem. Hanno -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
