
Hi Ceki, I know this isn't the right place/forum but I've noticed that the Log4cxx is using your server called: ShortSocketServer author: Ceki Gulcu and I'm having problems configuring it to work with Log4Cxx client. I was trying to get the Lockback SimpleSocketServer to communicate with Log4cxx client but I was unsuccessful too and in BOTH cases I got the following error: ERROR [main] org.apache.log4j.net.SocketNode (SocketNode.java:59) Could not open ObjectInputStream to Socket[addr=/127.0.0.1,port=2336,localport=6000] java.io.StreamCorruptedException: invalid stream header: 3C6C6F67 at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783) at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280) at org.apache.log4j.net.SocketNode.<init>(SocketNode.java:55) at org.apache.log4j.net.ShortSocketServer.main(ShortSocketServer.java:74) I thought maybe you could help me out a little... you know more about this than me :-) Is it even possible to mix these two guys and have them talk to each other? Please let me know. Thanks a lot. Greg.

I did not know that log4cxx was using ShortSocketServer. Anyway, the short socket server expects (java) serialized objects which can differ from one version of log4j to another. The logback and log4j objects for logging events are not compatible. When you say that you were unsuccessful in *both* cases, what is the case other than log4cxx-->logback ? Greg Flex wrote:
Hi Ceki, I know this isn't the right place/forum but I've noticed that the Log4cxx is using your server called: ShortSocketServer author: Ceki Gulcu and I'm having problems configuring it to work with Log4Cxx client. I was trying to get the Lockback SimpleSocketServer to communicate with Log4cxx client but I was unsuccessful too and in BOTH cases I got the following error: ERROR [main] org.apache.log4j.net.SocketNode (SocketNode.java:59) Could not open ObjectInputStream to Socket[addr=/127.0.0.1 <http://127.0.0.1>,port=2336,localport=6000] java.io.StreamCorruptedException: invalid stream header: 3C6C6F67 at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783) at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280) at org.apache.log4j.net.SocketNode.<init>(SocketNode.java:55) at org.apache.log4j.net.ShortSocketServer.main(ShortSocketServer.java:74)
I thought maybe you could help me out a little... you know more about this than me :-) Is it even possible to mix these two guys and have them talk to each other? Please let me know. Thanks a lot. Greg.
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch

No I was testing the Log4Cxx client with both the Lockback server and the Log4j server. (just to see it the Log4j works with it) (Ideally I'd like the Logback server communicate with the Log4cxx client. Is this possible?) (Basically I need Log4cxx logs along with the Logback logs intercepted by the Logback server.) Both servers, the Logback's SimpleSocketServer and Log4j's ShortSicketServer are throwing an exeption below: 2008-11-20 11:59:06,860 ERROR [Thread-0] [SocketNode.java:61] SocketNode - Could not open ObjectInputStream to Socket[addr=/127.0.0.1 ,port=2580,localport=6000] java.io.StreamCorruptedException: invalid stream header: 3C6C6F67 at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783) at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280) at SocketNode.<init>(SocketNode.java:59) at SimpleSocketServer.run(SimpleSocketServer.java:83) 2008-11-20 11:59:06,860 INFO [Thread-0] [SimpleSocketServer.java:79] SimpleSocketServer - Waiting to accept a new client. 2008-11-20 11:59:06,860 ERROR [Thread-1] [SocketNode.java:96] SocketNode - Unexpected exception. Closing connection. java.lang.NullPointerException at SocketNode.run(SocketNode.java:78) at java.lang.Thread.run(Thread.java:619) 2008-11-20 11:59:06,860 DEBUG [Thread-1] [SimpleSocketServer.java:133] SimpleSocketServer - Removing SocketNode/127.0.0.1:2580 So I'm wondering if it IS possible to make/mix these two guys. It looks like there isn't..... Let me know what you think, I can send you all the files you'd need to test this. Thank You Greg. On Thu, Nov 20, 2008 at 11:52 AM, Ceki Gulcu <listid@qos.ch> wrote:
I did not know that log4cxx was using ShortSocketServer. Anyway, the short socket server expects (java) serialized objects which can differ from one version of log4j to another. The logback and log4j objects for logging events are not compatible. When you say that you were unsuccessful in *both* cases, what is the case other than log4cxx-->logback ?
Greg Flex wrote:
Hi Ceki, I know this isn't the right place/forum but I've noticed that the Log4cxx is using your server called: ShortSocketServer author: Ceki Gulcu and I'm having problems configuring it to work with Log4Cxx client. I was trying to get the Lockback SimpleSocketServer to communicate with Log4cxx client but I was unsuccessful too and in BOTH cases I got the following error: ERROR [main] org.apache.log4j.net.SocketNode (SocketNode.java:59) Could not open ObjectInputStream to Socket[addr=/127.0.0.1 <http://127.0.0.1>,port=2336,localport=6000] java.io.StreamCorruptedException: invalid stream header: 3C6C6F67 at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783) at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280) at org.apache.log4j.net.SocketNode.<init>(SocketNode.java:55) at org.apache.log4j.net.ShortSocketServer.main(ShortSocketServer.java:74)
I thought maybe you could help me out a little... you know more about this than me :-) Is it even possible to mix these two guys and have them talk to each other? Please let me know. Thanks a lot. Greg.
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

Greg Flex wrote:
No I was testing the Log4Cxx client with both the Lockback server and the Log4j server. (just to see it the Log4j works with it) (Ideally I'd like the Logback server communicate with the Log4cxx client. Is this possible?)
log4jcxx cannot talk to logback server using serialized objects. However, log4cxx 0.10 is supposed to be able to talk to log4j version 1.2.15, although I have not tried this myself. -- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch

Thanks Ceki. I'll give this a try.... although the Log4j 1.2.15 is using the same server as the log4Cxx meaning the ShortSocketServer so I guess this won't work. Greg On Thu, Nov 20, 2008 at 12:38 PM, Ceki Gulcu <listid@qos.ch> wrote:
Greg Flex wrote:
No I was testing the Log4Cxx client with both the Lockback server and the Log4j server. (just to see it the Log4j works with it) (Ideally I'd like the Logback server communicate with the Log4cxx client. Is this possible?)
log4jcxx cannot talk to logback server using serialized objects. However, log4cxx 0.10 is supposed to be able to talk to log4j version 1.2.15, although I have not tried this myself.
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

Greg Flex skrev:
Thanks Ceki. I'll give this a try.... although the Log4j 1.2.15 is using the same server as the log4Cxx meaning the ShortSocketServer so I guess this won't work. If a server expects serialised objects, then nothing else will do.
It is pretty hard to generate a correct byte stream corresponding to serialized java objects from another language (but it can be done). I would suggest you raise a JIRA in logback about having a logback appender which can push log events over the network in XML form which can be accepted by log frameworks (perhaps even a slf4j socket server?) -- Thorbjørn Ravn Andersen "...plus... Tubular Bells!"

Ok guys so I gave up on the SocketAppender idea. It won't work. (at least not in an easy way) I'm trying to get the Log4cxx to work with the JDBCAppender now and it doesn't work too. I'm getting an exception: log4cxx: Class not found: org.apache.log4j.jdbc.JDBCAppender when running a c++ application the simplest possible. Just to get it to print some logs.... I don't understand this error? The RollingFileAppender works, the ConsoleAppender works even the XMLSocketAppender also works. It doesn't the way I'd like it to but it does work..... Maybe someone can help me figure this one out. Why the JDBCAppender throws this class not found exception. I appreciate any input or suggestion... Thank You Greg. On Thu, Nov 20, 2008 at 1:35 PM, Thorbjørn Ravn Andersen <ravn@runjva.com>wrote:
Greg Flex skrev:
Thanks Ceki. I'll give this a try.... although the Log4j 1.2.15 is using the same server as the log4Cxx meaning the ShortSocketServer so I guess this won't work. If a server expects serialised objects, then nothing else will do.
It is pretty hard to generate a correct byte stream corresponding to serialized java objects from another language (but it can be done).
I would suggest you raise a JIRA in logback about having a logback appender which can push log events over the network in XML form which can be accepted by log frameworks (perhaps even a slf4j socket server?)
-- Thorbjørn Ravn Andersen "...plus... Tubular Bells!"
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

Hi, Given this scenario, will the logback configuration conflict with each other? How many LoggerContext instance is created? - 3 different web applications hosted on 1 web container instance - Each web application has its own logback.xml, logging to different files. - logback jars (classic, core, sl4j) are shared by the 3 web app. Its located in the web container library folder. thanks, Jenny

Since logback will initialized only once, when the first web-app is loaded into memory. Thereafter, all logging will go to the same file. You must not share the logback jar by placing them on the web-container's lib directory. You should instead have each web-app carry its own copy of logback jars in WEB-INF./ib. Alternatively, you can use the JNDI repository selectors. However, wait for logback 0.9.12 and SLF4J 1.5.6 before delving into that. Jenny wrote:
Hi,
Given this scenario, will the logback configuration conflict with each other? How many LoggerContext instance is created?
- 3 different web applications hosted on 1 web container instance - Each web application has its own logback.xml, logging to different files. - logback jars (classic, core, sl4j) are shared by the 3 web app. Its located in the web container library folder.
thanks, Jenny
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch

Thanks Ceki! Logback is great. More power to the logback team! --- On Fri, 11/21/08, Ceki Gulcu <listid@qos.ch> wrote:
From: Ceki Gulcu <listid@qos.ch> Subject: Re: [logback-user] LoggerContext instance - how many are created? To: "logback users list" <logback-user@qos.ch> Date: Friday, November 21, 2008, 6:52 PM Since logback will initialized only once, when the first web-app is loaded into memory. Thereafter, all logging will go to the same file. You must not share the logback jar by placing them on the web-container's lib directory. You should instead have each web-app carry its own copy of logback jars in WEB-INF./ib.
Alternatively, you can use the JNDI repository selectors. However, wait for logback 0.9.12 and SLF4J 1.5.6 before delving into that.
Jenny wrote:
Hi,
Given this scenario, will the logback configuration conflict with each other? How many LoggerContext instance is created?
- 3 different web applications hosted on 1 web container instance - Each web application has its own logback.xml, logging to different files. - logback jars (classic, core, sl4j) are shared by the 3 web app. Its located in the web container library folder.
thanks, Jenny
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
participants (4)
-
Ceki Gulcu
-
Greg Flex
-
Jenny
-
Thorbjørn Ravn Andersen