You need to provide SocketServer with a log4j configuration file which
defines an XMLSocketReceiver.

Note that any events received by the receiver will be passed to the
appenders defined in the same configuration file, so you can write your own
appender and add it to the configuration to examine events or write the
events to a log file using the FileAppender, etc.

Here's a thread with more info and an example configuration:
http://www.mail-archive.com/[email protected]/msg08818.html

Scott

On Sun, Mar 8, 2009 at 10:48 AM, Gavin Gilmour <[email protected]>wrote:

> Hello there.
>
> I'm having some trouble re-constructing a LoggingEvent at the other end
> from
> a
> XML serialized one through a stream. I'm using the log4php project to
> generate
> and pass an event using LoggerXMLLayout and ultimately try to send it to a
> server using log4j which is listening for it. On the server side though,
> this
> is where I get a little confused.
>
> I'm basically just trying to capture that logging event at the server side
> to
> get the message, file information, etc. I've looked at using
> SimpleSocketServer, SimpleXMLSocketServer and tried a bunch of different
> ways
> to get it into something I can manage but I've been unsuccessful. I've
> managed
> to capture a XMLSocketNode using the SimpleXMLSocketServer using the
> approach
> here [1], but I'm not entirely sure what to do with that and I don't think
> it
> is what I'm after. Though, I think if I could manage to decode this
> XMLSocketNode it'd give me a LoggingEvent which is what I think I'm
> after(!)
>
> I think my downfall here is that I'm not so much worried about calling any
> other appenders to pass the event once I have it though, I'm just wanting
> to
> get the log message and level.
>
> Is there anybody who could offer a hand and perhaps a code snippet or so to
> point me in the right direction?
>
> Cheers!
>
> Gavin.
>
> [1] - http://marc.info/?l=log4j-user&m=110381363908634&w=2
>

Reply via email to