On Sep 27, 2007, at 10:38 AM, [EMAIL PROTECTED] wrote:


Hello again :)
I just digged a little deeper into the log4cxx project (awesome amount of code, that is ;) ) And found out something strange: The write(event); method which the Socket Appender uses to send it's events is all #if 0'ed out in loggingevent.cpp - therefore nothing is being sent via socket. Why is that? I would need to modify the appender anyways since I only want to send the message itself, not the event wrapped around it (because I have several languages talking to the same server) but I assumed I would at least find a working preset. Can anyone explain this to me please? :) I checked both the revisions that came with the VS2005 Project file and the latest svn, both have the write #if 0'ed out.
With regards,
Johannes Frank

There are two open and long standing bug reports that address this:

https://issues.apache.org/jira/browse/LOGCXX-7
https://issues.apache.org/jira/browse/LOGCXX-121


Basically, SocketAppender in log4j 1.2 uses Java serialization to serialize an org.apache.log4j.spi.LoggingEvent instance and then transmit the serialized representation of the event. Chainsaw can deserialize that representation and recreate an org.apache.log4j.spi.LoggingEvent instances and use those to update the viewer.

log4cxx and log4net both implemented appenders named SocketAppender, but they did not attempt to replicate the serialized form used by the log4j SocketAppender, so you could not connect a log4cxx SocketAppender to Chainsaw and have it work. Actually, I have no idea what you could connect either to since there aren't any matching receivers provided by the projects and no one reported that they had developed one.

When the log4cxx LoggingEvent was changed to support Unicode strings, the implementation of SocketAppender was stubbed out since it didn't make sense to spend time reworking the existing implementation before figuring out how to write a version that was compatible with the log4j binary format.

The XMLSocketAppenders in log4cxx and log4net do work with Chainsaw. If you are trying to support multiple languages, I use those or replicate their format if you want to support yet another language. In a perfect world, there would be an XMLSocketAppender in log4j and log4j-compatible SocketAppenders in log4cxx and log4net. Technically it is possible, but hasn't happened due to resource limitations. If you'd like to pitch in, feel free to contribute.

Reply via email to