@ChannelHandler.Sharable public class LoggingHandler extends java.lang.Object implements ChannelUpstreamHandler, ChannelDownstreamHandler
ChannelHandler that logs all events via InternalLogger.
By default, all events are logged at DEBUG level. You can extend
this class and override log(ChannelEvent) to change the default
behavior.ChannelHandler.Sharable| 构造器和说明 |
|---|
LoggingHandler()
Creates a new instance whose logger name is the fully qualified class
name of the instance with hex dump enabled.
|
LoggingHandler(boolean hexDump)
Creates a new instance whose logger name is the fully qualified class
name of the instance.
|
LoggingHandler(java.lang.Class<?> clazz)
Creates a new instance with the specified logger name and with hex dump
enabled.
|
LoggingHandler(java.lang.Class<?> clazz,
boolean hexDump)
Creates a new instance with the specified logger name.
|
LoggingHandler(java.lang.Class<?> clazz,
InternalLogLevel level)
Creates a new instance with the specified logger name.
|
LoggingHandler(java.lang.Class<?> clazz,
InternalLogLevel level,
boolean hexDump)
Creates a new instance with the specified logger name.
|
LoggingHandler(InternalLogLevel level)
Creates a new instance whose logger name is the fully qualified class
name of the instance.
|
LoggingHandler(InternalLogLevel level,
boolean hexDump)
Creates a new instance whose logger name is the fully qualified class
name of the instance.
|
LoggingHandler(java.lang.String name)
Creates a new instance with the specified logger name and with hex dump
enabled.
|
LoggingHandler(java.lang.String name,
boolean hexDump)
Creates a new instance with the specified logger name.
|
LoggingHandler(java.lang.String name,
InternalLogLevel level,
boolean hexDump)
Creates a new instance with the specified logger name.
|
| 限定符和类型 | 方法和说明 |
|---|---|
InternalLogLevel |
getLevel()
Returns the
InternalLogLevel that this handler uses to log
a ChannelEvent. |
InternalLogger |
getLogger()
Returns the
InternalLogger that this handler uses to log
a ChannelEvent. |
void |
handleDownstream(ChannelHandlerContext ctx,
ChannelEvent e)
Handles the specified downstream event.
|
void |
handleUpstream(ChannelHandlerContext ctx,
ChannelEvent e)
Handles the specified upstream event.
|
void |
log(ChannelEvent e)
Logs the specified event to the
InternalLogger returned by
getLogger(). |
public LoggingHandler()
public LoggingHandler(InternalLogLevel level)
level - the log levelpublic LoggingHandler(boolean hexDump)
hexDump - true if and only if the hex dump of the received
message is loggedpublic LoggingHandler(InternalLogLevel level, boolean hexDump)
level - the log levelhexDump - true if and only if the hex dump of the received
message is loggedpublic LoggingHandler(java.lang.Class<?> clazz)
public LoggingHandler(java.lang.Class<?> clazz,
boolean hexDump)
hexDump - true if and only if the hex dump of the received
message is loggedpublic LoggingHandler(java.lang.Class<?> clazz,
InternalLogLevel level)
level - the log levelpublic LoggingHandler(java.lang.Class<?> clazz,
InternalLogLevel level,
boolean hexDump)
level - the log levelhexDump - true if and only if the hex dump of the received
message is loggedpublic LoggingHandler(java.lang.String name)
public LoggingHandler(java.lang.String name,
boolean hexDump)
hexDump - true if and only if the hex dump of the received
message is loggedpublic LoggingHandler(java.lang.String name,
InternalLogLevel level,
boolean hexDump)
level - the log levelhexDump - true if and only if the hex dump of the received
message is loggedpublic InternalLogger getLogger()
InternalLogger that this handler uses to log
a ChannelEvent.public InternalLogLevel getLevel()
InternalLogLevel that this handler uses to log
a ChannelEvent.public void log(ChannelEvent e)
InternalLogger returned by
getLogger(). If hex dump has been enabled for this handler,
the hex dump of the ChannelBuffer in a MessageEvent will
be logged together.public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws java.lang.Exception
ChannelUpstreamHandlerhandleUpstream 在接口中 ChannelUpstreamHandlerctx - the context object for this handlere - the upstream event to process or interceptjava.lang.Exceptionpublic void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws java.lang.Exception
ChannelDownstreamHandlerhandleDownstream 在接口中 ChannelDownstreamHandlerctx - the context object for this handlere - the downstream event to process or interceptjava.lang.Exception