I'm not sure what format log4cxx's SocketAppender uses to send logging events.
Try using an XMLSocketAppender on the log4cxx side and an XMLSocketReceiver on the SimpleSocketServer side. Scott On Wed, Mar 25, 2009 at 10:17 AM, Moley Harey <[email protected]> wrote: > Hi folks, > > I have implemented a Java SimpleSocketServer application that is running > with log4j version 1.2, I have done a test Java class that initialize the > logging and sends a couple of messages to the SimpleSocketServer and works > fine, all messages sent by the test class are succesfully written in the > same log file. > > Then I have done the same with a C++ log4cxx application, updating the > log4cxx.properties file to be like this: > > log4j.rootCategory=DEBUG,stdout,A1 > > log4j.appender.stdout=org.apache.log4j.ConsoleAppender > log4j.appender.stdout.layout=org.apache.log4j.PatternLayout > > log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n > > # A1 is set to be a SocketAppender sending its output to the server running > on the remote host, port 4445 > log4j.appender.A1=org.apache.log4j.net.SocketAppender > log4j.appender.A1.Port=4445 > log4j.appender.A1.RemoteHost=127.0.0.1 > > I have run my C++ application and what I get in my log file are just the > following messages: > > 2009-03-25 17:14:33,914 INFO NRTSocketServer - NRTSocketServer :: > Connected > to client at /127.0.0.1 > 2009-03-25 17:14:33,969 INFO NRTSocketServer - NRTSocketServer :: Starting > new socket node. > > And after this no debug or info message is logged, just when my C++ > application has finished I get the following message: > > 2009-03-25 17:16:25,290 ERROR org.apache.log4j.net.SocketNode - Could not > open ObjectInputStream to Socket[addr=/127.0.0.1 > ,port=36965,localport=4445] > java.io.EOFException > at > > java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2228) > at > > java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2694) > at > java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:761) > at java.io.ObjectInputStream.<init>(ObjectInputStream.java:277) > at org.apache.log4j.net.SocketNode.<init>(SocketNode.java:55) > at NRTSocketServer.main(NRTSocketServer.java:46) > > So from logging messages from Java application using log4j to Java > ServerSocket works fine, but from C++ application using log4cxx 0.10 does > not work... > > Could be the problem the type of Appender I am using? Maybe I should use > something like XMLSocketAppender or so? > > Thanks in advance, > > Mh >
