@Test public void shouldLogIOExceptionWithoutStackWhenThereIsNoCause() throws Exception { LoggingFilter filter = new ExceptionLoggingFilter(logger, "tcp%s"); final Exception exception = new IOException(); exception.fillInStackTrace(); context.checking(new Expectations() { { oneOf(logger).isInfoEnabled(); will(returnValue(true)); oneOf(session).getId(); will(returnValue(123L)); oneOf(logger).info(with(stringMatching(".*IOException.*"))); oneOf(nextFilter).exceptionCaught(session, exception); } }); filter.exceptionCaught(nextFilter, session, exception); }
@Override public void exceptionCaught(NextFilter nextFilter, IoSession session, Throwable cause) throws Exception { logExceptionCaught(session, cause); super.exceptionCaught(nextFilter, session, cause); }
LoggingFilter extends IoFilterAdapter { @Override public void exceptionCaught(NextFilter nextFilter, IoSession session, Throwable cause) throws Exception { logExceptionCaught(session, cause); super.exceptionCaught(nextFilter, session, cause); } }
LoggingFilter extends IoFilterAdapter { @Override public void exceptionCaught(NextFilter nextFilter, IoSession session, Throwable cause) throws Exception { logExceptionCaught(session, cause); super.exceptionCaught(nextFilter, session, cause); } LoggingFilter(Logger logger);  LoggingFilter(Logger logger, IoSession session, String transportName);  LoggingFilter(Logger logger, String sessionIdFormat); }
LoggingFilter extends IoFilterAdapter { @Override public void exceptionCaught(NextFilter nextFilter, IoSession session, Throwable cause) throws Exception { logExceptionCaught(session, cause); super.exceptionCaught(nextFilter, session, cause); } LoggingFilter(Logger logger);  LoggingFilter(Logger logger, IoSession session, String transportName);  LoggingFilter(Logger logger, String sessionIdFormat); static boolean addIfNeeded(Logger logger, IoSession session, String transportName); LogLevel getLevel(); Logger getLogger(); String getFormat(); @Override void sessionCreated(NextFilter nextFilter,
                               IoSession session); @Override void sessionOpened(NextFilter nextFilter,
                              IoSession session); @Override void messageReceived(NextFilter nextFilter,
                                IoSession session,
                                Object message); @Override void messageSent(NextFilter nextFilter,
                            IoSession session,
                            WriteRequest writeRequest); @Override void sessionIdle(NextFilter nextFilter,
                            IoSession session,
                            IdleStatus status); @Override void exceptionCaught(NextFilter nextFilter,
                                IoSession session,
                                Throwable cause); @Override void sessionClosed(NextFilter nextFilter,
                              IoSession session); @Override void filterWrite(NextFilter nextFilter,
                            IoSession session,
                            WriteRequest writeRequest); static void moveAfterCodec(IoSession session); }
LoggingFilter extends IoFilterAdapter { @Override public void exceptionCaught(NextFilter nextFilter, IoSession session, Throwable cause) throws Exception { logExceptionCaught(session, cause); super.exceptionCaught(nextFilter, session, cause); } LoggingFilter(Logger logger);  LoggingFilter(Logger logger, IoSession session, String transportName);  LoggingFilter(Logger logger, String sessionIdFormat); static boolean addIfNeeded(Logger logger, IoSession session, String transportName); LogLevel getLevel(); Logger getLogger(); String getFormat(); @Override void sessionCreated(NextFilter nextFilter,
                               IoSession session); @Override void sessionOpened(NextFilter nextFilter,
                              IoSession session); @Override void messageReceived(NextFilter nextFilter,
                                IoSession session,
                                Object message); @Override void messageSent(NextFilter nextFilter,
                            IoSession session,
                            WriteRequest writeRequest); @Override void sessionIdle(NextFilter nextFilter,
                            IoSession session,
                            IdleStatus status); @Override void exceptionCaught(NextFilter nextFilter,
                                IoSession session,
                                Throwable cause); @Override void sessionClosed(NextFilter nextFilter,
                              IoSession session); @Override void filterWrite(NextFilter nextFilter,
                            IoSession session,
                            WriteRequest writeRequest); static void moveAfterCodec(IoSession session);  }