@ChannelHandler.Sharable public class LoggingHandler extends ChannelHandlerAdapter
ChannelHandler that logs all events using a logging framework.
By default, all events are logged at DEBUG level.ChannelHandler.Sharable, ChannelHandler.Skip| Modifier and Type | Field and Description |
|---|---|
protected io.netty.util.internal.logging.InternalLogLevel |
internalLevel |
protected io.netty.util.internal.logging.InternalLogger |
logger |
| Constructor and Description |
|---|
LoggingHandler()
Creates a new instance whose logger name is the fully qualified class
name of the instance with hex dump enabled.
|
LoggingHandler(Class<?> clazz)
Creates a new instance with the specified logger name and with hex dump
enabled.
|
LoggingHandler(Class<?> clazz,
LogLevel level)
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(String name)
Creates a new instance with the specified logger name using the default log level.
|
LoggingHandler(String name,
LogLevel level)
Creates a new instance with the specified logger name.
|
channelReadComplete, channelWritabilityChanged, handlerAdded, handlerRemoved, isSharable, readprotected final io.netty.util.internal.logging.InternalLogger logger
protected final io.netty.util.internal.logging.InternalLogLevel internalLevel
public LoggingHandler()
public LoggingHandler(LogLevel level)
level - the log levelpublic LoggingHandler(Class<?> clazz)
clazz - the class type to generate the logger forpublic LoggingHandler(Class<?> clazz, LogLevel level)
clazz - the class type to generate the logger forlevel - the log levelpublic LoggingHandler(String name)
name - the name of the class to use for the loggerpublic void channelRegistered(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapterChannelHandlerContext.fireChannelRegistered() to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelRegistered in interface ChannelHandlerchannelRegistered in class ChannelHandlerAdapterExceptionpublic void channelUnregistered(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapterChannelHandlerContext.fireChannelUnregistered() to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelUnregistered in interface ChannelHandlerchannelUnregistered in class ChannelHandlerAdapterExceptionpublic void channelActive(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapterChannelHandlerContext.fireChannelActive() to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelActive in interface ChannelHandlerchannelActive in class ChannelHandlerAdapterExceptionpublic void channelInactive(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapterChannelHandlerContext.fireChannelInactive() to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelInactive in interface ChannelHandlerchannelInactive in class ChannelHandlerAdapterExceptionpublic void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
ChannelHandlerAdapterChannelHandlerContext.fireExceptionCaught(Throwable) to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.exceptionCaught in interface ChannelHandlerexceptionCaught in class ChannelHandlerAdapterExceptionpublic void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception
ChannelHandlerAdapterChannelHandlerContext.fireUserEventTriggered(Object) to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.userEventTriggered in interface ChannelHandleruserEventTriggered in class ChannelHandlerAdapterExceptionpublic void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) throws Exception
ChannelHandlerAdapterChannelHandlerContext.bind(java.net.SocketAddress, ChannelPromise) to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.bind in interface ChannelHandlerbind in class ChannelHandlerAdapterctx - the ChannelHandlerContext for which the bind operation is madelocalAddress - the SocketAddress to which it should boundpromise - the ChannelPromise to notify once the operation completesException - thrown if an error accourpublic void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) throws Exception
ChannelHandlerAdapterChannelHandlerContext.connect(SocketAddress, SocketAddress, ChannelPromise) to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.connect in interface ChannelHandlerconnect in class ChannelHandlerAdapterctx - 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 completesException - thrown if an error accourpublic void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception
ChannelHandlerAdapterChannelHandlerContext.disconnect(ChannelPromise) to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.disconnect in interface ChannelHandlerdisconnect in class ChannelHandlerAdapterctx - the ChannelHandlerContext for which the disconnect operation is madepromise - the ChannelPromise to notify once the operation completesException - thrown if an error accourpublic void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception
ChannelHandlerAdapterChannelHandlerContext.close(ChannelPromise) to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.close in interface ChannelHandlerclose in class ChannelHandlerAdapterctx - the ChannelHandlerContext for which the close operation is madepromise - the ChannelPromise to notify once the operation completesException - thrown if an error accourpublic void deregister(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception
ChannelHandlerAdapterChannelHandlerContext.deregister(ChannelPromise) to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.deregister in interface ChannelHandlerderegister in class ChannelHandlerAdapterctx - the ChannelHandlerContext for which the close operation is madepromise - the ChannelPromise to notify once the operation completesException - thrown if an error accourpublic void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
ChannelHandlerAdapterChannelHandlerContext.fireChannelRead(Object) to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelRead in interface ChannelHandlerchannelRead in class ChannelHandlerAdapterExceptionpublic void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception
ChannelHandlerAdapterChannelHandlerContext.write(Object) to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.write in interface ChannelHandlerwrite in class ChannelHandlerAdapterctx - the ChannelHandlerContext for which the write operation is mademsg - the message to writepromise - the ChannelPromise to notify once the operation completesException - thrown if an error accourpublic void flush(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapterChannelHandlerContext.flush() to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.flush in interface ChannelHandlerflush in class ChannelHandlerAdapterctx - the ChannelHandlerContext for which the flush operation is madeException - thrown if an error accourprotected String format(ChannelHandlerContext ctx, String eventName)
eventName - the name of the eventprotected String format(ChannelHandlerContext ctx, String eventName, Object arg)
eventName - the name of the eventarg - the argument of the eventprotected String format(ChannelHandlerContext ctx, String eventName, Object firstArg, Object secondArg)
ChannelHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise).eventName - the name of the eventfirstArg - the first argument of the eventsecondArg - the second argument of the eventprotected static void appendHexDump(StringBuilder dump, ByteBuf buf)
ByteBuf to the specified
StringBuilder.Copyright © 2008–2015 The Netty Project. All rights reserved.