| Author |
about SimpleSocketServet
|
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
I'm trying to use SimpleSocketServet but keep getting the following messages: INFO [Thread-6] (SocketNode.java:86) - Caught java.io.EOFException closing conneciton. INFO [Thread-7] (SocketNode.java:88) - Caught java.net.SocketException closing conneciton. If anybody managed to use SocketAppender, please help. Couldn't do it with Chainsaw either.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Carol Enderlin
drifter
Ranch Hand
Joined: Oct 10, 2000
Posts: 1348
|
|
So, is it not working or you're just getting those errors in the log when the client disconnects? You don't give a lot of details to work off. I've tried out the examples in the Complete log4j manual (commercial - $ - worth every penny) and it worked. Here's the SimpleSocketServer output from running a client a couple of times: C:\xxxx\log4j-manual-2004-12-12\examples>java org.apache.log4j.net.SimpleSocketServer 6000 chapter4/server1.xml log4j: Threshold ="null". log4j: Level value for root is [debug]. log4j: root level set to DEBUG log4j: Class name: [org.apache.log4j.ConsoleAppender] log4j: Parsing layout of class: "org.apache.log4j.PatternLayout" log4j: Setting property [conversionPattern] to [%d %-5p [%t] %c - %m%n]. log4j: Adding appender named [CONSOLE] to category [root]. log4j: Class name: [org.apache.log4j.RollingFileAppender] log4j: Setting property [file] to [rolling.log]. log4j: Setting property [maxFileSize] to [8KB]. log4j: Setting property [maxBackupIndex] to [3]. log4j: Parsing layout of class: "org.apache.log4j.PatternLayout" log4j: Setting property [conversionPattern] to [%r %-5p %c - %m%n]. log4j: setFile called: rolling.log, true log4j: setFile ended log4j: Adding appender named [ROLLING] to category [root]. 2006-10-25 08:24:47,790 INFO [main] org.apache.log4j.net.SimpleSocketServer - Listening on port 6000 2006-10-25 08:24:47,810 INFO [main] org.apache.log4j.net.SimpleSocketServer - Waiting to accept a new client. 2006-10-25 08:24:51,746 INFO [main] org.apache.log4j.net.SimpleSocketServer - Connected to client at /127.0.0.1 2006-10-25 08:24:51,746 INFO [main] org.apache.log4j.net.SimpleSocketServer - Starting new socket node. 2006-10-25 08:24:51,756 INFO [main] org.apache.log4j.net.SimpleSocketServer - Waiting to accept a new client. 2006-10-25 08:25:20,979 DEBUG [main] chapter4.SocketClient2 - hello Satou 2006-10-25 08:25:24,544 DEBUG [main] chapter4.SocketClient2 - bye 2006-10-25 08:25:34,659 INFO [Thread-0] org.apache.log4j.net.SocketNode - Caught java.net.SocketException closing conneciton 2006-10-25 09:49:24,602 INFO [main] org.apache.log4j.net.SimpleSocketServer - Connected to client at /127.0.0.1 2006-10-25 09:49:24,602 INFO [main] org.apache.log4j.net.SimpleSocketServer - Starting new socket node. 2006-10-25 09:49:24,602 INFO [main] org.apache.log4j.net.SimpleSocketServer - Waiting to accept a new client. 2006-10-25 09:49:29,509 DEBUG [main] chapter4.SocketClient2 - Hi Again 2006-10-25 09:49:33,114 DEBUG [main] chapter4.SocketClient2 - Bye again 2006-10-25 09:49:33,795 INFO [Thread-1] org.apache.log4j.net.SocketNode - Caught java.net.SocketException closing conneciton .
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
Thanks for replying. I'm getting errors when sending messages to the server. When I launch the server, here is what I've got: INFO [main] (SimpleSocketServer.java:59) - Listening on port 6000 INFO [main] (SimpleSocketServer.java:62) - Waiting to accept a new client. Ok. But when I execute the client, the following errors are displayed : INFO [main] (SimpleSocketServer.java:64) - Connected to client at /127.0.0.1 INFO [main] (SimpleSocketServer.java:65) - Starting new socket node. INFO [main] (SimpleSocketServer.java:62) - Waiting to accept a new client. INFO [main] (SimpleSocketServer.java:64) - Connected to client at /127.0.0.1 INFO [Thread-0] (SocketNode.java:86) - Caught java.io.EOFException closing conn eciton. INFO [main] (SimpleSocketServer.java:65) - Starting new socket node. INFO [main] (SimpleSocketServer.java:62) - Waiting to accept a new client. INFO [Thread-1] (SocketNode.java:88) - Caught java.net.SocketException closing conneciton. I don't know what's happening. Both server and client are on localhost, but I don't think this is the problem. Maybe I've got some configuration problems. Here's my server's property file : For the client, I use the following appender :
|
 |
Carol Enderlin
drifter
Ranch Hand
Joined: Oct 10, 2000
Posts: 1348
|
|
The error says it's an exception when closing the connection so it doesn't really sound like it's having the problem when sending messages (not that is proof or anything). The example client configuration looks like yours. It does also have one more param, but when I removed that param it still worked for me: <param name="ReconnectionDelay" value="30000"/> I am running on windows xp with two cmd windows open, also using localhost/6000 for the client host/port settings. So, what is the server appender attached to? What level is it set for and what level are you logging at? What is your client doing? Post some more config and code sample. The example client I'm using sets up a loop asking for input and does a logger.debug for each line entered until a 'q' is entered to quit. So, I can really see the difference between a log message and a disconnect. I've been using log4j versions 1.2.9 and 1.2.14, how about you?
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
I'm using 1.2.14. I've managed to output the messages on the server side by correcting my client appender, and to remove the SocketException by calling LogManager.shutdown(), as written in the API. I'm still getting the EOFException though. Could you show me your config for the server ? If I set the following line, the exception is not output : log4j.category.org.apache.log4j.net.SocketNode=ERROR
|
 |
Carol Enderlin
drifter
Ranch Hand
Joined: Oct 10, 2000
Posts: 1348
|
|
OK, that makes sense since the exception is printed out at INFO level. There isn't anything special in the server1.xml file used to configure the server's output, nothing to show you really (The config file is associated with the book "The complete log4j manual", by Ceki Gulcu.):
<!-- This config file is intended to be used by a SocketServer that logs --> <!-- events received from various clients on the console and to a file --> <!-- that is rolled over when appropriate. The interesting point to note --> <!-- is that it is a configuration file like any other. -->
It defines the root logger with two appenders. [ October 27, 2006: Message edited by: Carol Enderlin ]
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
|
Ok, Carol. Thanks for helping.
|
 |
Clara Rey
Greenhorn
Joined: Jul 24, 2009
Posts: 3
|
|
Hi Christophe,
I have the same problem.
Have you found a solution?
Regards,
Clara
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
Sorry Clara,
you're referring to a 2.5 years old thread, which I don't even remember
I really can't remember, sorry.
|
 |
Clara Rey
Greenhorn
Joined: Jul 24, 2009
Posts: 3
|
|
Ihave found the solution.
I had several problem with log4j in Glassfish. I use SocketAppender to send logs to a Remote Socket.
The solution was to change my Glassfish version. The error was:
INFO [Thread-0] (SocketNode.java:86) - Caught java.io.EOFException closing conneciton.
With my new version i don't have any more this problem.
see yo soon
|
 |
 |
|
|
subject: about SimpleSocketServet
|
|
|