https://issues.apache.org/bugzilla/show_bug.cgi?id=48220
--- Comment #3 from Lars Beuster <[email protected]> 2009-11-19 02:16:07 UTC --- Yes, the toString()-call could be a good idea and would solve the problem for non-serializable values. But I had also another problem. I've put my own serializable object into the MDC-context. But it couldn't be deserialized at the other side because my classfile wasn't present there. In my special case I've put an application object into the MDC-context. I didn't want to use the toString()-presentation because this method was too heavy. My object was only used in an ErrorAppender with a PatternLayout that used the MDC-value. So toString() was only called in an error case. Another developer had a SocketAppender in his log4j.xml in conjunction with log4eclipse as the server socket - and ran into the problem. So for now I've created a SocketAppender-subclass that modifies the LoggingEvent by replacing the mdcCopy-values with it's toString()-representations - per reflection because the fields are private. The heavy toString()-method of my object is now called on every logging event (not only in an error case) - but that's ok, since it's a developer system. But I don't know if this is a solution that is suitable for everybody using log4j. Perhaps it's possible to activate this behavior with a special option (global or local on every serializing appender). Regards Lars -- 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]
