The only thing is that the SocketNode class seems to be removed in 0.10.0
I will try with 0.9.7


On Sat, May 17, 2008 at 1:47 PM, rizwan khalid <> wrote:


Few months back Amit Sarna sent me a working example for client/server loggers. It uses SockeAppender but it should be easily converted to XMLSocketAppender. Below i am pasting the Amit's email which will help you in building the sample attached with this mail...

Hi Rizwan,

  Sorry for delayed response. This is my work e-mail so can't see it on weekends. I've attached the source and config files in a .RAR file.  It's a very simple example but enough to show how to do a client and a server. I haven't included make files because our makefiles use a lot of environment vars specific to our app but if you can't get it compiling i can try and rustle one up for you tonight.


The config files should be in the same directory as the executables. When you've compiled both, run the server first, then run the client. This should produce two log files, the client one should log as expected, and the server one should log it's own stuff and also messages sent from the client app.


If you need any explanation on anything drop me a mail and i'll do my best :-)




Rizwan Khalid
Phone: +92 021 2781592
14th Floor, National IT Park, Shahra-e-Faisal
Karachi, Pakistan


--------- Original message --------
From: "Curt Arnold"
To: "Log4CXX User"
Subject: [SPAM] Re: Server side socket usage
Date: 05-16-08 01:17

On May 15, 2008, at 9:45 AM, Ruud Bos wrote:

> Hello,
> I'm new to the list, so I have no idea if this question has been
> asked many times before. I hope someone can put me in the right
> direction.
> I'd like to use log4cxx for two applications. One acts as a client
> that needs to send it's logging to a server application using socket
> communication. Both programs are written in C++.
> From the few things I could find on the internet about the use of
> the ServerSocket class, I was not able to create something that
> works. Most of these only talk about the client side and use the
> java substitute log4j for the server side.
> If someone could point me to some example code, that would be
> extremely helpful.
> Thanks in advance,
> Ruud

log4cxx 0.9.7 came with an implementation of both the client and
server side for SocketAppender, but used its own format that was not
platform independent. So if the sender and receiver differed in
endianness, character type, int length or the like, bad things would

log4cxx 0.10.0 replaced that with an implementation that produced a
stream format compatible with log4j's format (the Java serialization
of its LoggingEvent class). This allows interoperability with
Chainsaw and eliminated the platform variation of the format.

There is a huge degree of variability allowed with Java serialization
so it is much easier to write a logging event that can be read by Java
serialization than reliably read a logging event written by Java
serialization. You could write code that read log4cxx's specific take
on it, but that would be unlikely to reliably read events from log4j.

If you were going to receive events from log4cxx, I would suggest
using the XMLSocketAppender as the format would require less custom
code to parse the stream format. I'm sorry, but I'm not aware of any
sample code for it.