org.apache.mina.filter.logging

## Class LoggingFilter

- java.lang.Object
- - org.apache.mina.core.filterchain.IoFilterAdapter
  - - org.apache.mina.filter.logging.LoggingFilter

- All Implemented Interfaces:
    IoFilter

      public class LoggingFilter
      extends IoFilterAdapter

  Logs all MINA protocol events. Each event can be tuned to use a different level based on the user's specific requirements. Methods are in place that allow the user to use either the get or set method for each event and pass in the `IoEventType` and the `LogLevel`. By default, all events are logged to the `LogLevel.INFO` level except `IoFilterAdapter.exceptionCaught(IoFilter.NextFilter, IoSession, Throwable)`, which is logged to `LogLevel.WARN`.
  Author:
    Apache MINA Project

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.mina.core.filterchain.IoFilter

      `IoFilter.NextFilter`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LoggingFilter()` Default Constructor.
    `LoggingFilter(Class<?> clazz)` Create a new NoopFilter using a class name
    `LoggingFilter(String name)` Create a new NoopFilter using a name

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `exceptionCaught(IoFilter.NextFilter nextFilter, IoSession session, Throwable cause)` Filters `IoHandler.exceptionCaught(IoSession,Throwable)` event.
    `LogLevel` | `getExceptionCaughtLogLevel()` Get the LogLevel for the ExceptionCaught event.
    `LogLevel` | `getMessageReceivedLogLevel()` Get the LogLevel for the MessageReceived event.
    `LogLevel` | `getMessageSentLogLevel()` Get the LogLevel for the MessageSent event.
    `String` | `getName()`
    `LogLevel` | `getSessionClosedLogLevel()` Get the LogLevel for the SessionClosed event.
    `LogLevel` | `getSessionCreatedLogLevel()` Get the LogLevel for the SessionCreated event.
    `LogLevel` | `getSessionIdleLogLevel()` Get the LogLevel for the SessionIdle event.
    `LogLevel` | `getSessionOpenedLogLevel()` Get the LogLevel for the SessionOpened event.
    `void` | `messageReceived(IoFilter.NextFilter nextFilter, IoSession session, Object message)` Filters `IoHandler.messageReceived(IoSession,Object)` event.
    `void` | `messageSent(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest)` Filters `IoHandler.messageSent(IoSession,Object)` event.
    `void` | `sessionClosed(IoFilter.NextFilter nextFilter, IoSession session)` Filters `IoHandler.sessionClosed(IoSession)` event.
    `void` | `sessionCreated(IoFilter.NextFilter nextFilter, IoSession session)` Filters `IoHandler.sessionCreated(IoSession)` event.
    `void` | `sessionIdle(IoFilter.NextFilter nextFilter, IoSession session, IdleStatus status)` Filters `IoHandler.sessionIdle(IoSession,IdleStatus)` event.
    `void` | `sessionOpened(IoFilter.NextFilter nextFilter, IoSession session)` Filters `IoHandler.sessionOpened(IoSession)` event.
    `void` | `setExceptionCaughtLogLevel(LogLevel level)` Set the LogLevel for the ExceptionCaught event.
    `void` | `setMessageReceivedLogLevel(LogLevel level)` Set the LogLevel for the MessageReceived event.
    `void` | `setMessageSentLogLevel(LogLevel level)` Set the LogLevel for the MessageSent event.
    `void` | `setSessionClosedLogLevel(LogLevel level)` Set the LogLevel for the SessionClosed event.
    `void` | `setSessionCreatedLogLevel(LogLevel level)` Set the LogLevel for the SessionCreated event.
    `void` | `setSessionIdleLogLevel(LogLevel level)` Set the LogLevel for the SessionIdle event.
    `void` | `setSessionOpenedLogLevel(LogLevel level)` Set the LogLevel for the SessionOpened event.

    - ### Methods inherited from class org.apache.mina.core.filterchain.IoFilterAdapter

      `destroy, filterClose, filterWrite, init, onPostAdd, onPostRemove, onPreAdd, onPreRemove, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### LoggingFilter

          public LoggingFilter()

      Default Constructor.

    - #### LoggingFilter

          public LoggingFilter(Class<?> clazz)

      Create a new NoopFilter using a class name
      Parameters:
        `clazz` - the cass which name will be used to create the logger

    - #### LoggingFilter

          public LoggingFilter(String name)

      Create a new NoopFilter using a name
      Parameters:
        `name` - the name used to create the logger. If null, will default to "NoopFilter"

  - ### Method Detail

    - #### getName

          public String getName()

      Returns:
        The logger's name

    - #### exceptionCaught

          public void exceptionCaught(IoFilter.NextFilter nextFilter,
                             IoSession session,
                             Throwable cause)
                               throws Exception

      Description copied from class: `IoFilterAdapter`
      Filters `IoHandler.exceptionCaught(IoSession,Throwable)` event.
      Specified by:
        `exceptionCaught` in interface `IoFilter`
      Overrides:
        `exceptionCaught` in class `IoFilterAdapter`
      Throws:
        `Exception`

    - #### messageReceived

          public void messageReceived(IoFilter.NextFilter nextFilter,
                             IoSession session,
                             Object message)
                               throws Exception

      Description copied from class: `IoFilterAdapter`
      Filters `IoHandler.messageReceived(IoSession,Object)` event.
      Specified by:
        `messageReceived` in interface `IoFilter`
      Overrides:
        `messageReceived` in class `IoFilterAdapter`
      Throws:
        `Exception`

    - #### messageSent

          public void messageSent(IoFilter.NextFilter nextFilter,
                         IoSession session,
                         WriteRequest writeRequest)
                           throws Exception

      Description copied from class: `IoFilterAdapter`
      Filters `IoHandler.messageSent(IoSession,Object)` event.
      Specified by:
        `messageSent` in interface `IoFilter`
      Overrides:
        `messageSent` in class `IoFilterAdapter`
      Throws:
        `Exception`

    - #### sessionCreated

          public void sessionCreated(IoFilter.NextFilter nextFilter,
                            IoSession session)
                              throws Exception

      Description copied from class: `IoFilterAdapter`
      Filters `IoHandler.sessionCreated(IoSession)` event.
      Specified by:
        `sessionCreated` in interface `IoFilter`
      Overrides:
        `sessionCreated` in class `IoFilterAdapter`
      Throws:
        `Exception`

    - #### sessionOpened

          public void sessionOpened(IoFilter.NextFilter nextFilter,
                           IoSession session)
                             throws Exception

      Description copied from class: `IoFilterAdapter`
      Filters `IoHandler.sessionOpened(IoSession)` event.
      Specified by:
        `sessionOpened` in interface `IoFilter`
      Overrides:
        `sessionOpened` in class `IoFilterAdapter`
      Throws:
        `Exception`

    - #### sessionIdle

          public void sessionIdle(IoFilter.NextFilter nextFilter,
                         IoSession session,
                         IdleStatus status)
                           throws Exception

      Description copied from class: `IoFilterAdapter`
      Filters `IoHandler.sessionIdle(IoSession,IdleStatus)` event.
      Specified by:
        `sessionIdle` in interface `IoFilter`
      Overrides:
        `sessionIdle` in class `IoFilterAdapter`
      Throws:
        `Exception`

    - #### sessionClosed

          public void sessionClosed(IoFilter.NextFilter nextFilter,
                           IoSession session)
                             throws Exception

      Description copied from class: `IoFilterAdapter`
      Filters `IoHandler.sessionClosed(IoSession)` event.
      Specified by:
        `sessionClosed` in interface `IoFilter`
      Overrides:
        `sessionClosed` in class `IoFilterAdapter`
      Throws:
        `Exception`

    - #### setExceptionCaughtLogLevel

          public void setExceptionCaughtLogLevel(LogLevel level)

      Set the LogLevel for the ExceptionCaught event.
      Parameters:
        `level` - The LogLevel to set

    - #### getExceptionCaughtLogLevel

          public LogLevel getExceptionCaughtLogLevel()

      Get the LogLevel for the ExceptionCaught event.
      Returns:
        The LogLevel for the ExceptionCaught eventType

    - #### setMessageReceivedLogLevel

          public void setMessageReceivedLogLevel(LogLevel level)

      Set the LogLevel for the MessageReceived event.
      Parameters:
        `level` - The LogLevel to set

    - #### getMessageReceivedLogLevel

          public LogLevel getMessageReceivedLogLevel()

      Get the LogLevel for the MessageReceived event.
      Returns:
        The LogLevel for the MessageReceived eventType

    - #### setMessageSentLogLevel

          public void setMessageSentLogLevel(LogLevel level)

      Set the LogLevel for the MessageSent event.
      Parameters:
        `level` - The LogLevel to set

    - #### getMessageSentLogLevel

          public LogLevel getMessageSentLogLevel()

      Get the LogLevel for the MessageSent event.
      Returns:
        The LogLevel for the MessageSent eventType

    - #### setSessionCreatedLogLevel

          public void setSessionCreatedLogLevel(LogLevel level)

      Set the LogLevel for the SessionCreated event.
      Parameters:
        `level` - The LogLevel to set

    - #### getSessionCreatedLogLevel

          public LogLevel getSessionCreatedLogLevel()

      Get the LogLevel for the SessionCreated event.
      Returns:
        The LogLevel for the SessionCreated eventType

    - #### setSessionOpenedLogLevel

          public void setSessionOpenedLogLevel(LogLevel level)

      Set the LogLevel for the SessionOpened event.
      Parameters:
        `level` - The LogLevel to set

    - #### getSessionOpenedLogLevel

          public LogLevel getSessionOpenedLogLevel()

      Get the LogLevel for the SessionOpened event.
      Returns:
        The LogLevel for the SessionOpened eventType

    - #### setSessionIdleLogLevel

          public void setSessionIdleLogLevel(LogLevel level)

      Set the LogLevel for the SessionIdle event.
      Parameters:
        `level` - The LogLevel to set

    - #### getSessionIdleLogLevel

          public LogLevel getSessionIdleLogLevel()

      Get the LogLevel for the SessionIdle event.
      Returns:
        The LogLevel for the SessionIdle eventType

    - #### setSessionClosedLogLevel

          public void setSessionClosedLogLevel(LogLevel level)

      Set the LogLevel for the SessionClosed event.
      Parameters:
        `level` - The LogLevel to set

    - #### getSessionClosedLogLevel

          public LogLevel getSessionClosedLogLevel()

      Get the LogLevel for the SessionClosed event.
      Returns:
        The LogLevel for the SessionClosed eventType

Copyright © 2004-2012 Apache MINA Project. All Rights Reserved.