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.
| Modifier and Type | Field and Description |
|---|---|
| private final BufferFormat | |
| private static final LogLevel | |
| protected final InternalLogLevel | |
| private final LogLevel | |
| protected final InternalLogger |
| Access | Constructor and Description |
|---|---|
| public | LoggingHandler()
Creates a new instance whose logger name is the fully qualified class name of the instance with hex dump enabled. |
| public | LoggingHandler(BufferFormat
Format of ByteBuf dumping format)Creates a new instance whose logger name is the fully qualified class name of the instance. |
| public | LoggingHandler(LogLevel
the log level level)Creates a new instance whose logger name is the fully qualified class name of the instance. |
| public | LoggingHandler(LogLevel
the log level level, BufferFormat the ByteBuf format bufferFormat)Creates a new instance whose logger name is the fully qualified class name of the instance. |
| public | LoggingHandler(Class<?>
the class type to generate the logger for clazz)Creates a new instance with the specified logger name and with hex dump enabled. |
| public | LoggingHandler(Class<?>
the class type to generate the logger for clazz, LogLevel the log level level)Creates a new instance with the specified logger name. |
| public | LoggingHandler(Class<?>
the class type to generate the logger for clazz, LogLevel the log level level, BufferFormat the ByteBuf format bufferFormat)Creates a new instance with the specified logger name. |
| public | LoggingHandler(String
the name of the class to use for the logger name)Creates a new instance with the specified logger name using the default log level. |
| public | LoggingHandler(String
the name of the class to use for the logger name, LogLevel the log level level)Creates a new instance with the specified logger name. |
| public | LoggingHandler(String
the name of the class to use for the logger name, LogLevel the log level level, BufferFormat the ByteBuf format bufferFormat)Creates a new instance with the specified logger name. |
| Modifier and Type | Method and Description |
|---|---|
| public Future | bind(ChannelHandlerContext
the ctx, SocketAddress ChannelHandlerContext for which the bind operation is madethe localAddress)SocketAddress to which it should boundOverrides default io. |
| public BufferFormat | |
| public void | channelActive(ChannelHandlerContext ctx)
Overrides default io. Channel of the ChannelHandlerContext is now active
|
| public void | channelExceptionCaught(ChannelHandlerContext ctx, Throwable cause)
Overrides default io. Throwable was thrown when handling inbound events.
|
| public void | channelInactive(ChannelHandlerContext ctx)
Overrides default io. Channel of the ChannelHandlerContext was registered is now inactive and reached its
end of lifetime.
|
| public void | channelInboundEvent(ChannelHandlerContext ctx, Object evt)
Overrides default io. |
| public void | channelRead(ChannelHandlerContext ctx, Object msg)
Overrides default io. Channel has read a message from the peer.
|
| public void | channelReadComplete(ChannelHandlerContext ctx)
Overrides default io. channelRead(ChannelHandlerContext, Object).
|
| public void | channelRegistered(ChannelHandlerContext ctx)
Overrides default io. Channel of the ChannelHandlerContext was registered with its EventLoop
|
| public void | channelUnregistered(ChannelHandlerContext ctx)
Overrides default io. Channel of the ChannelHandlerContext was unregistered from its EventLoop
|
| public void | channelWritabilityChanged(ChannelHandlerContext ctx)
Overrides default io. Channel changed.
|
| public Future | close(ChannelHandlerContext
the ctx)ChannelHandlerContext for which the close operation is madeOverrides default io. |
| public Future | connect(ChannelHandlerContext
the ctx, SocketAddress ChannelHandlerContext for which the connect operation is madethe remoteAddress, SocketAddress SocketAddress to which it should connectthe localAddress)SocketAddress which is used as source on connectOverrides default io. |
| public Future | deregister(ChannelHandlerContext
the ctx)ChannelHandlerContext for which the deregister operation is madeOverrides default io. EventLoop.
|
| public Future | disconnect(ChannelHandlerContext
the ctx)ChannelHandlerContext for which the disconnect operation is madeOverrides default io. |
| public void | flush(ChannelHandlerContext
the ctx)ChannelHandlerContext for which the flush operation is madeOverrides default io. |
| protected String | format(ChannelHandlerContext ctx, String
the name of the event eventName)Formats an event and returns the formatted message. |
| protected String | format(ChannelHandlerContext ctx, String
the name of the event eventName, Object the argument of the event arg)Formats an event and returns the formatted message. |
| protected String | format(ChannelHandlerContext ctx, String
the name of the event eventName, Object the first argument of the event firstArg, Object the second argument of the event secondArg)Formats an event and returns the formatted message. |
| private String | formatBuffer(ChannelHandlerContext ctx, String eventName, Buffer msg)
Generates the default log message of the specified event whose argument is a |
| private static String | formatSimple(ChannelHandlerContext ctx, String eventName, Object msg)
Generates the default log message of the specified event whose argument is an arbitrary object. |
| public boolean | isSharable()
Overrides default io. true if this handler is sharable and thus can be added
to more than one ChannelPipeline.
|
| public LogLevel | |
| public Future | write(ChannelHandlerContext
the ctx, Object ChannelHandlerContext for which the write operation is madethe message to write msg)Overrides default io. |
| bufferFormat | back to summary |
|---|---|
| private final BufferFormat bufferFormat | |
| DEFAULT_LEVEL | back to summary |
|---|---|
| private static final LogLevel DEFAULT_LEVEL | |
| internalLevel | back to summary |
|---|---|
| protected final InternalLogLevel internalLevel | |
| level | back to summary |
|---|---|
| private final LogLevel level | |
| logger | back to summary |
|---|---|
| protected final InternalLogger logger | |
| LoggingHandler | back to summary |
|---|---|
| public LoggingHandler() Creates a new instance whose logger name is the fully qualified class name of the instance with hex dump enabled. | |
| LoggingHandler | back to summary |
|---|---|
| public LoggingHandler(BufferFormat format) Creates a new instance whose logger name is the fully qualified class name of the instance.
| |
| LoggingHandler | back to summary |
|---|---|
| public LoggingHandler(LogLevel level) Creates a new instance whose logger name is the fully qualified class name of the instance.
| |
| LoggingHandler | back to summary |
|---|---|
| public LoggingHandler(LogLevel level, BufferFormat bufferFormat) Creates a new instance whose logger name is the fully qualified class name of the instance.
| |
| LoggingHandler | back to summary |
|---|---|
| public LoggingHandler(Class<?> clazz) Creates a new instance with the specified logger name and with hex dump enabled.
| |
| LoggingHandler | back to summary |
|---|---|
| public LoggingHandler(Class<?> clazz, LogLevel level) Creates a new instance with the specified logger name. | |
| LoggingHandler | back to summary |
|---|---|
| public LoggingHandler(Class<?> clazz, LogLevel level, BufferFormat bufferFormat) Creates a new instance with the specified logger name.
| |
| LoggingHandler | back to summary |
|---|---|
| public LoggingHandler(String name) Creates a new instance with the specified logger name using the default log level.
| |
| LoggingHandler | back to summary |
|---|---|
| public LoggingHandler(String name, LogLevel level) Creates a new instance with the specified logger name. | |
| LoggingHandler | back to summary |
|---|---|
| public LoggingHandler(String name, LogLevel level, BufferFormat bufferFormat) Creates a new instance with the specified logger name.
| |
| bind | back to summary |
|---|---|
| public Future Overrides default io. Doc from io. Called once a bind operation is made.
| |
| bufferFormat | back to summary |
|---|---|
| public BufferFormat bufferFormat() Returns the | |
| channelActive | back to summary |
|---|---|
| public void channelActive(ChannelHandlerContext ctx) throws Exception Overrides default io. Doc from io. The
| |
| channelExceptionCaught | back to summary |
|---|---|
| public void channelExceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception Overrides default io. Doc from io. Gets called if a
| |
| channelInactive | back to summary |
|---|---|
| public void channelInactive(ChannelHandlerContext ctx) throws Exception Overrides default io. Doc from io. The
| |
| channelInboundEvent | back to summary |
|---|---|
| public void channelInboundEvent(ChannelHandlerContext ctx, Object evt) throws Exception Overrides default io. Doc from io. Gets called if a custom inbound event happened.
| |
| channelRead | back to summary |
|---|---|
| public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception Overrides default io. Doc from io. Invoked when the current
| |
| channelReadComplete | back to summary |
|---|---|
| public void channelReadComplete(ChannelHandlerContext ctx) throws Exception Overrides default io. Doc from io. Invoked when the last message read by the current read operation has been consumed by
| |
| channelRegistered | back to summary |
|---|---|
| public void channelRegistered(ChannelHandlerContext ctx) throws Exception Overrides default io. Doc from io. The
| |
| channelUnregistered | back to summary |
|---|---|
| public void channelUnregistered(ChannelHandlerContext ctx) throws Exception Overrides default io. Doc from io. The
| |
| channelWritabilityChanged | back to summary |
|---|---|
| public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception Overrides default io. Doc from io. Gets called once the writable state of a
| |
| close | back to summary |
|---|---|
| public Future Overrides default io. Doc from io. Called once a close operation is made.
| |
| connect | back to summary |
|---|---|
| public Future Overrides default io. Doc from io. Called once a connect operation is made.
| |
| deregister | back to summary |
|---|---|
| public Future Overrides default io. Doc from io. Called once a deregister operation is made from the current registered
| |
| disconnect | back to summary |
|---|---|
| public Future Overrides default io. Doc from io. Called once a disconnect operation is made.
| |
| flush | back to summary |
|---|---|
| public void flush(ChannelHandlerContext ctx) Overrides default io. Doc from io. Called once a flush operation is made. The flush operation will try to flush out all previous written messages that are pending.
| |
| format | back to summary |
|---|---|
| protected String format(ChannelHandlerContext ctx, String eventName) Formats an event and returns the formatted message.
| |
| format | back to summary |
|---|---|
| protected String format(ChannelHandlerContext ctx, String eventName, Object arg) Formats an event and returns the formatted message. | |
| format | back to summary |
|---|---|
| protected String format(ChannelHandlerContext ctx, String eventName, Object firstArg, Object secondArg) Formats an event and returns the formatted message. This method is currently only used for formatting
| |
| formatBuffer | back to summary |
|---|---|
| private String formatBuffer(ChannelHandlerContext ctx, String eventName, Buffer msg) Generates the default log message of the specified event whose argument is a | |
| formatSimple | back to summary |
|---|---|
| private static String formatSimple(ChannelHandlerContext ctx, String eventName, Object msg) Generates the default log message of the specified event whose argument is an arbitrary object. | |
| isSharable | back to summary |
|---|---|
| public boolean isSharable() Overrides default io. Doc from io. Returns
| |
| level | back to summary |
|---|---|
| public LogLevel level() Returns the | |
| write | back to summary |
|---|---|
| public Future Overrides default io. Doc from io. Called once a write operation is made. The write operation will write the messages through the
| |