I'm having a play with mina-core-2.0.0-M1-20071221.061156-110

I'm using slf4j-simple-1.4.3.

If I add a LoggingFilter using addLast to the filter chain (as the first such addLast call), then the logging filter will use its EXCEPTION_CAUGHT if I have a socket client that connects, does not send anything, and then disconnects.

The trace looks like:

Listening on port 2960
10836 [NioProcessor-1] WARN org.apache.mina.filter.logging.LoggingFilter - [/127.0.0.1:4036] EXCEPTION: java.io.IOException: An existing connection was forcibly closed by the remote host
   at sun.nio.ch.SocketDispatcher.read0(Native Method)
   at sun.nio.ch.SocketDispatcher.read(Unknown Source)
   at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
(and so on)

Two things:

1) I'd like to receive this in the exceptionCaught method of my IoHandlerAdapter - and if I don't push the logger into the filter chain then its what happens.

2) It doesn't seem to be thrown for clients that connect, write a message (which I handle with a specialised codec) and then quites.

I'd like to have the filter so I can turn on logging for the session and message events, but setting the log level to NONE for EXCEPTION_CAUGHT doesn't pass it on - it seems to consume it silently.

Is there any way I can achieve what I want? Ideally I'd like my exceptionCaught handler to be called first and to be able to filter the exception at that level, so that only exceptions I don't discard will be reported by the filter.

A further issue is that if I 'pass on' to super.exceptionCaught then I get 'please implement <myclass>.exceptionCaught() for proper handling' and in the case of a client dumping the connection untidily without writing the exception repeats - nothing closes the session and the process spams its log.

Is the difference of behaviour between the cases of a client that does write and one that doesn't indicative of a bug?

James

Reply via email to