logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Moley Harey <moleyha...@gmail.com>
Subject Problems with log4j SimpleSocketServer connection
Date Wed, 25 Mar 2009 17:17:54 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message