public class LoggingFilter extends IoFilterAdapter
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
.IoFilter.NextFilter
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
|
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.
|
destroy, event, filterClose, filterWrite, init, inputClosed, onPostAdd, onPostRemove, onPreAdd, onPreRemove, toString
public LoggingFilter()
public LoggingFilter(Class<?> clazz)
clazz
- the cass which name will be used to create the loggerpublic LoggingFilter(String name)
name
- the name used to create the logger. If null, will default to "NoopFilter"public String getName()
public void exceptionCaught(IoFilter.NextFilter nextFilter, IoSession session, Throwable cause) throws Exception
IoHandler.exceptionCaught(IoSession,Throwable)
event.exceptionCaught
in interface IoFilter
exceptionCaught
in class IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventcause
- The exception that cause this event to be receivedException
- If an error occurred while processing the eventpublic void messageReceived(IoFilter.NextFilter nextFilter, IoSession session, Object message) throws Exception
IoHandler.messageReceived(IoSession,Object)
event.messageReceived
in interface IoFilter
messageReceived
in class IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventmessage
- The received messageException
- If an error occurred while processing the eventpublic void messageSent(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception
IoHandler.messageSent(IoSession,Object)
event.messageSent
in interface IoFilter
messageSent
in class IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventwriteRequest
- The WriteRequest
that contains the sent messageException
- If an error occurred while processing the eventpublic void sessionCreated(IoFilter.NextFilter nextFilter, IoSession session) throws Exception
IoHandler.sessionCreated(IoSession)
event.sessionCreated
in interface IoFilter
sessionCreated
in class IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventException
- If an error occurred while processing the eventpublic void sessionOpened(IoFilter.NextFilter nextFilter, IoSession session) throws Exception
IoHandler.sessionOpened(IoSession)
event.sessionOpened
in interface IoFilter
sessionOpened
in class IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventException
- If an error occurred while processing the eventpublic void sessionIdle(IoFilter.NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception
IoHandler.sessionIdle(IoSession,IdleStatus)
event.sessionIdle
in interface IoFilter
sessionIdle
in class IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventstatus
- The IdleStatus
typeException
- If an error occurred while processing the eventpublic void sessionClosed(IoFilter.NextFilter nextFilter, IoSession session) throws Exception
IoHandler.sessionClosed(IoSession)
event.sessionClosed
in interface IoFilter
sessionClosed
in class IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventException
- If an error occurred while processing the eventpublic void setExceptionCaughtLogLevel(LogLevel level)
level
- The LogLevel to setpublic LogLevel getExceptionCaughtLogLevel()
public void setMessageReceivedLogLevel(LogLevel level)
level
- The LogLevel to setpublic LogLevel getMessageReceivedLogLevel()
public void setMessageSentLogLevel(LogLevel level)
level
- The LogLevel to setpublic LogLevel getMessageSentLogLevel()
public void setSessionCreatedLogLevel(LogLevel level)
level
- The LogLevel to setpublic LogLevel getSessionCreatedLogLevel()
public void setSessionOpenedLogLevel(LogLevel level)
level
- The LogLevel to setpublic LogLevel getSessionOpenedLogLevel()
public void setSessionIdleLogLevel(LogLevel level)
level
- The LogLevel to setpublic LogLevel getSessionIdleLogLevel()
public void setSessionClosedLogLevel(LogLevel level)
level
- The LogLevel to setpublic LogLevel getSessionClosedLogLevel()
Copyright © 2004–2021 Apache MINA Project. All rights reserved.