@ChannelHandler.Sharable public class LoggingHandler extends ChannelDuplexHandler
ChannelHandler that logs all events using a logging framework.
By default, all events are logged at DEBUG level and full hex dumps are recorded for ByteBufs.ChannelHandler.Sharable| 限定符和类型 | 字段和说明 |
|---|---|
protected InternalLogLevel |
internalLevel |
protected InternalLogger |
logger |
| 构造器和说明 |
|---|
LoggingHandler()
Creates a new instance whose logger name is the fully qualified class
name of the instance with hex dump enabled.
|
LoggingHandler(ByteBufFormat format)
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,
LogLevel level)
Creates a new instance with the specified logger name.
|
LoggingHandler(java.lang.Class<?> clazz,
LogLevel level,
ByteBufFormat byteBufFormat)
Creates a new instance with the specified logger name.
|
LoggingHandler(LogLevel level)
Creates a new instance whose logger name is the fully qualified class
name of the instance.
|
LoggingHandler(LogLevel level,
ByteBufFormat byteBufFormat)
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 using the default log level.
|
LoggingHandler(java.lang.String name,
LogLevel level)
Creates a new instance with the specified logger name.
|
LoggingHandler(java.lang.String name,
LogLevel level,
ByteBufFormat byteBufFormat)
Creates a new instance with the specified logger name.
|
readensureNotSharable, handlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlerAdded, handlerRemovedprotected final InternalLogger logger
protected final InternalLogLevel internalLevel
public LoggingHandler()
public LoggingHandler(ByteBufFormat format)
format - Format of ByteBuf dumpingpublic LoggingHandler(LogLevel level)
level - the log levelpublic LoggingHandler(LogLevel level, ByteBufFormat byteBufFormat)
level - the log levelbyteBufFormat - the ByteBuf formatpublic LoggingHandler(java.lang.Class<?> clazz)
clazz - the class type to generate the logger forpublic LoggingHandler(java.lang.Class<?> clazz,
LogLevel level)
clazz - the class type to generate the logger forlevel - the log levelpublic LoggingHandler(java.lang.Class<?> clazz,
LogLevel level,
ByteBufFormat byteBufFormat)
clazz - the class type to generate the logger forlevel - the log levelbyteBufFormat - the ByteBuf formatpublic LoggingHandler(java.lang.String name)
name - the name of the class to use for the loggerpublic LoggingHandler(java.lang.String name,
LogLevel level)
name - the name of the class to use for the loggerlevel - the log levelpublic LoggingHandler(java.lang.String name,
LogLevel level,
ByteBufFormat byteBufFormat)
name - the name of the class to use for the loggerlevel - the log levelbyteBufFormat - the ByteBuf formatpublic ByteBufFormat byteBufFormat()
ByteBufFormat that this handler uses to logpublic void channelRegistered(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireChannelRegistered() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelRegistered 在接口中 ChannelInboundHandlerchannelRegistered 在类中 ChannelInboundHandlerAdapterjava.lang.Exceptionpublic void channelUnregistered(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireChannelUnregistered() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelUnregistered 在接口中 ChannelInboundHandlerchannelUnregistered 在类中 ChannelInboundHandlerAdapterjava.lang.Exceptionpublic void channelActive(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireChannelActive() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelActive 在接口中 ChannelInboundHandlerchannelActive 在类中 ChannelInboundHandlerAdapterjava.lang.Exceptionpublic void channelInactive(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireChannelInactive() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelInactive 在接口中 ChannelInboundHandlerchannelInactive 在类中 ChannelInboundHandlerAdapterjava.lang.Exceptionpublic void exceptionCaught(ChannelHandlerContext ctx, java.lang.Throwable cause) throws java.lang.Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireExceptionCaught(Throwable) to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.exceptionCaught 在接口中 ChannelHandlerexceptionCaught 在接口中 ChannelInboundHandlerexceptionCaught 在类中 ChannelInboundHandlerAdapterjava.lang.Exceptionpublic void userEventTriggered(ChannelHandlerContext ctx, java.lang.Object evt) throws java.lang.Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireUserEventTriggered(Object) to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.userEventTriggered 在接口中 ChannelInboundHandleruserEventTriggered 在类中 ChannelInboundHandlerAdapterjava.lang.Exceptionpublic void bind(ChannelHandlerContext ctx, java.net.SocketAddress localAddress, ChannelPromise promise) throws java.lang.Exception
ChannelDuplexHandlerChannelOutboundInvoker.bind(SocketAddress, ChannelPromise) to forward
to the next ChannelOutboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.bind 在接口中 ChannelOutboundHandlerbind 在类中 ChannelDuplexHandlerctx - the ChannelHandlerContext for which the bind operation is madelocalAddress - the SocketAddress to which it should boundpromise - the ChannelPromise to notify once the operation completesjava.lang.Exception - thrown if an error occurspublic void connect(ChannelHandlerContext ctx, java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise) throws java.lang.Exception
ChannelDuplexHandlerChannelOutboundInvoker.connect(SocketAddress, SocketAddress, ChannelPromise) to forward
to the next ChannelOutboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.connect 在接口中 ChannelOutboundHandlerconnect 在类中 ChannelDuplexHandlerctx - the ChannelHandlerContext for which the connect operation is maderemoteAddress - the SocketAddress to which it should connectlocalAddress - the SocketAddress which is used as source on connectpromise - the ChannelPromise to notify once the operation completesjava.lang.Exception - thrown if an error occurspublic void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) throws java.lang.Exception
ChannelDuplexHandlerChannelOutboundInvoker.disconnect(ChannelPromise) to forward
to the next ChannelOutboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.disconnect 在接口中 ChannelOutboundHandlerdisconnect 在类中 ChannelDuplexHandlerctx - the ChannelHandlerContext for which the disconnect operation is madepromise - the ChannelPromise to notify once the operation completesjava.lang.Exception - thrown if an error occurspublic void close(ChannelHandlerContext ctx, ChannelPromise promise) throws java.lang.Exception
ChannelDuplexHandlerChannelOutboundInvoker.close(ChannelPromise) to forward
to the next ChannelOutboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.close 在接口中 ChannelOutboundHandlerclose 在类中 ChannelDuplexHandlerctx - the ChannelHandlerContext for which the close operation is madepromise - the ChannelPromise to notify once the operation completesjava.lang.Exception - thrown if an error occurspublic void deregister(ChannelHandlerContext ctx, ChannelPromise promise) throws java.lang.Exception
ChannelDuplexHandlerChannelOutboundInvoker.deregister(ChannelPromise) to forward
to the next ChannelOutboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.deregister 在接口中 ChannelOutboundHandlerderegister 在类中 ChannelDuplexHandlerctx - the ChannelHandlerContext for which the close operation is madepromise - the ChannelPromise to notify once the operation completesjava.lang.Exception - thrown if an error occurspublic void channelReadComplete(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireChannelReadComplete() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelReadComplete 在接口中 ChannelInboundHandlerchannelReadComplete 在类中 ChannelInboundHandlerAdapterjava.lang.Exceptionpublic void channelRead(ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireChannelRead(Object) to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelRead 在接口中 ChannelInboundHandlerchannelRead 在类中 ChannelInboundHandlerAdapterjava.lang.Exceptionpublic void write(ChannelHandlerContext ctx, java.lang.Object msg, ChannelPromise promise) throws java.lang.Exception
ChannelDuplexHandlerChannelOutboundInvoker.write(Object, ChannelPromise) to forward
to the next ChannelOutboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.write 在接口中 ChannelOutboundHandlerwrite 在类中 ChannelDuplexHandlerctx - the ChannelHandlerContext for which the write operation is mademsg - the message to writepromise - the ChannelPromise to notify once the operation completesjava.lang.Exception - thrown if an error occurspublic void channelWritabilityChanged(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireChannelWritabilityChanged() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelWritabilityChanged 在接口中 ChannelInboundHandlerchannelWritabilityChanged 在类中 ChannelInboundHandlerAdapterjava.lang.Exceptionpublic void flush(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelDuplexHandlerChannelHandlerContext.flush() to forward
to the next ChannelOutboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.flush 在接口中 ChannelOutboundHandlerflush 在类中 ChannelDuplexHandlerctx - the ChannelHandlerContext for which the flush operation is madejava.lang.Exception - thrown if an error occursprotected java.lang.String format(ChannelHandlerContext ctx, java.lang.String eventName)
eventName - the name of the eventprotected java.lang.String format(ChannelHandlerContext ctx, java.lang.String eventName, java.lang.Object arg)
eventName - the name of the eventarg - the argument of the eventprotected java.lang.String format(ChannelHandlerContext ctx, java.lang.String eventName, java.lang.Object firstArg, java.lang.Object secondArg)
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise).eventName - the name of the eventfirstArg - the first argument of the eventsecondArg - the second argument of the event