Hello,
I think this issue is specific to the AIX VM. As Anders indicated the SocketNode loop
does not expect to receive an IOException. However, if you study the code you will see
that the error message is purely defensive. Nothing bad actually happens.
One solution is to "expect" IOExceptions, to report them as an info message without
the exception. Here is the new code:
---- SocketNode.java -----------
public void run() {
LoggingEvent event;
Category remoteCategory;
try {
while(true) {
event = (LoggingEvent) ois.readObject();
remoteCategory = hierarchy.getInstance(event.categoryName);
event.category = remoteCategory;
if(event.priority.isGreaterOrEqual(remoteCategory.getChainedPriority())) {
remoteCategory.callAppenders(event);
}
}
}
catch(java.io.EOFException e) {
cat.info("Caught java.io.EOFException closing conneciton.");
} catch(java.net.SocketException e) {
cat.info("Caught java.net.SocketException closing conneciton.");
} catch(IOException e) {
cat.info("Caught java.io.IOException: "+e); // it's a + not ,
cat.info("Closing connection.");
} catch(Exception e) {
cat.error("Unexpected exception. Closing conneciton.", e);
}
Regards, Ceki
ps: Anders, I'll check this in unless you have another approach.
At 14:08 21.06.2001 -0400, Anders Kristensen wrote:
>[EMAIL PROTECTED] wrote:
>>
>> I am somewhat new to log4j but am looking forward to gaining experience with it
>> and possibly contributing to the product itself. Being a totally blind
>> programmer, many interactive debugging tools are not productively useful to me
>> through my speech/Braille output software. However, log4j seems to give me a
>> controllable output which is very easy to read and understand.
>>
>> I have setup a script on an AIX machine to run the SimpleSocketServer class and
>> configured my client application (running on Windows NT) to send log records to
>> that server. The log records are coming through to the server just fine and
>> everything looks good until the client application ends. Then I get the error
>> message below on the output of the log server.
>>
>> [2001-06-21 11:12:21] net.SocketNode() - Unexpected exception. Closing
>> conneciton.
>> java.io.IOException: A connection with a remote socket was reset by that socket.
>> at java.net.SocketInputStream.read(Compiled Code)
>> at java.net.SocketInputStream.read(Compiled Code)
>> at java.io.ObjectInputStream.peekCode(Compiled Code)
>> at java.io.ObjectInputStream.refill(Compiled Code)
>> at java.io.ObjectInputStream.readObject(Compiled Code)
>> at java.io.ObjectInputStream.readObject(Compiled Code)
>> at org.apache.log4j.net.SocketNode.run(Compiled Code)
>> at java.lang.Thread.run(Compiled Code)
>
>The SimpleSocketServer handles EOFException and SocketExceptions as
>indicative of a graceful shutdown, but not IOExceptions. This is why it
>logs the exception stacktrace. This is probably not the best behaviour
>given that current log4j clients will not usually close the sockets
>before exiting.
>
>>
>> I have tried putting a finalize method in my application with a .shutdown() call
>> to the two category names being used.
>
>Category.shutdown is a static method -- no point in invoking it twice.
>
>Cheers,
>Anders
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]