logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wilfong, Paul" <paul.wilf...@ngc.com>
Subject RE: Socket Appender not functional?
Date Thu, 27 Sep 2007 16:30:50 GMT
Curt's reply provides the basic answer.  His information about the
XMLAppender in log4cxx is the key.

The log4j and log4cxx message forums have additional posts about this.
For example, see...
http://www.mail-archive.com/log4cxx-user@logging.apache.org/msg00941.htm
l

If want to log from your C program via ethernet to a log4j receiver on
another computer, then there are a number of posts on the log4j user
forum that may be of help.  For example, see...
 http://www.mail-archive.com/log4j-user@logging.apache.org/msg08816.html

At the time I posted this I was encountering the same challenges you
described.  If you read through this post and the related responses, and
dig some more through the log4j stuff about XML appenders and receivers,
it should help keep you going.

If you are planning to use log4j (say if you have Java programs and/or
want to use a log4j-based server), be sure to start right away using
log4j 1.2.15 - NOT 1.3.

Also, take a look at the info for the log4j "companions" for 1.2.15.

Finally, here are a couple of fairly recent posts that might be relevant
as you get further along...
https://issues.apache.org/jira/browse/LOGCXX-191
http://www.mail-archive.com/log4j-user@logging.apache.org/msg09050.html

Hope this helps... 



-----Original Message-----
From: Curt Arnold [mailto:carnold@apache.org] 
Sent: Thursday, September 27, 2007 9:20 AM
To: Log4CXX User
Subject: Re: Socket Appender not functional?


On Sep 27, 2007, at 10:38 AM, Johannes.Frank@kisters.de 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.

Mime
View raw message