logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Esther Parrilla-Endrino <eparril...@gmail.com>
Subject Re: How to build simplesocketserver binary file?
Date Wed, 25 Mar 2009 16:48:40 GMT
Hi Renny and all,

I have followed your instructions and implemented a Java SimpleSocketServer
application that is running with log4j, 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 my 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

2009/3/25 <renny.koshy@rubixinfotech.com>

>
> Since Log4CXX has a wire format that is compatible, you can download
> Log4J... it has a SimpleSocketServer.   We use it for centralizing the logs
> into one file as well.
>
> The link to the docs are:
> http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/net/SimpleSocketServer.html
>
> Renny Koshy
> President & CEO
>
> --------------------------------------------
> Rubix Information Technologies, Inc.
> www.rubixinfotech.com
>
>
>  *Esther Parrilla-Endrino <eparrillae@gmail.com>*
>
> 03/25/2009 03:55 AM
>  Please respond to
> "Log4CXX User" <log4cxx-user@logging.apache.org>
>
>   To
> Log4CXX User <log4cxx-user@logging.apache.org>  cc
> carnold@apache.org  Subject
> Re: How to build simplesocketserver binary file?
>
>
>
>
> Hi Curt,
>
> Thanks for your answer.
>
> My problem is that I have several processes writing concurrently in the
> same log file and all of them using log4cxx API, as far as I understood the
> simplesocketserver binary allowed me to centralize the management of all log
> messages avoiding problems with concurrency, my idea was to add a
> SocketAppender in my log4cxx.properties file that redirects all log messages
> coming from the different applications to the  simplesocketserver binary so
> it can manage that and write properly all messages in the same log file.
>
> Now you tell me that in log4cxx version 0.10 thay have dropped the
> distribution of this binary file, which is a bad news for me...
>
> Have you got an idea of any other application similar to simplesocketserver
> that I couls use for my purposes?
> Do you know if is possible to get the source code of the simplesocketserver
> binary for me to recompile it with log4cxx 0.10?
>
> Thanks in advance,
>
> Mh
>
> 2009/3/25 Curt Arnold <*carnold@apache.org* <carnold@apache.org>>
>
> On Mar 24, 2009, at 10:19 AM, Moley Harey wrote:
>
> Hi,
>
> I have downloaded apache-log4cxx-0.10.0.tar.gz from Apacheś log4cxx web
> site and built the lib using the commands: configure, make, make install
>
> After that the lirbrary has been successfully built but the binary file
> "simplesocketserver" has not been generated :/
>
> How can I get that?
>
> Thanks in advance,
>
> Mh
>
>
>
>
> In log4cxx 0.10, the binary format for the SocketAppender was changed to be
> compatible with log4j 1.2's, so that Chainsaw and any other application that
> could connect to log4j's SocketAppender.  However, that support is
> write-only, it is fairly simple to write something that log4j can consume,
> but massively complicated to consume anything the log4j might produce.
>  Since there log4cxx was compatible with log4j's binary format and log4j
> provides SocketReceivers, simplesocketserver was dropped.
>
> Also, The log4cxx 0.9.7 wire format was not platform independent, a x86_64
> build could not connect to a x86 build or a little-endian to a big-endian.
>
>
>
> --
> "Wer von seinem Tag nicht zwei Drittel für sich hat, ist ein Sklave." - F.
> Nietzsche, Menschliches, Allzumenschliches I, Aph. 283
>



-- 
"Wer von seinem Tag nicht zwei Drittel für sich hat, ist ein Sklave." - F.
Nietzsche, Menschliches, Allzumenschliches I, Aph. 283

Mime
View raw message