Class Log4J2LoggingHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.ChannelDuplexHandler
-
- io.netty.handler.logging.LoggingHandler
-
- com.linkedin.alpini.netty4.handlers.Log4J2LoggingHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler
public class Log4J2LoggingHandler extends io.netty.handler.logging.LoggingHandlerCreated by acurtis on 4/20/18.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.logging.log4j.LevelinternalLevelprotected org.apache.logging.log4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description Log4J2LoggingHandler()Creates a new instance whose logger name is the fully qualified class name of the instance with hex dump enabled.Log4J2LoggingHandler(io.netty.handler.logging.LogLevel level)Creates a new instance whose logger name is the fully qualified class name of the instance.Log4J2LoggingHandler(java.lang.Class<?> clazz)Creates a new instance with the specified logger name and with hex dump enabled.Log4J2LoggingHandler(java.lang.Class<?> clazz, io.netty.handler.logging.LogLevel level)Creates a new instance with the specified logger name.Log4J2LoggingHandler(java.lang.String name)Creates a new instance with the specified logger name using the default log level.Log4J2LoggingHandler(java.lang.String name, io.netty.handler.logging.LogLevel level)Creates a new instance with the specified logger name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(io.netty.channel.ChannelHandlerContext ctx, java.net.SocketAddress localAddress, io.netty.channel.ChannelPromise promise)voidchannelActive(io.netty.channel.ChannelHandlerContext ctx)voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx)voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg)voidchannelReadComplete(io.netty.channel.ChannelHandlerContext ctx)voidchannelRegistered(io.netty.channel.ChannelHandlerContext ctx)voidchannelUnregistered(io.netty.channel.ChannelHandlerContext ctx)voidchannelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx)voidclose(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)voidconnect(io.netty.channel.ChannelHandlerContext ctx, java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, io.netty.channel.ChannelPromise promise)voidderegister(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)voiddisconnect(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable cause)voidflush(io.netty.channel.ChannelHandlerContext ctx)voiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object evt)voidwrite(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg, io.netty.channel.ChannelPromise promise)-
Methods inherited from class io.netty.handler.logging.LoggingHandler
byteBufFormat, format, format, format, level
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Constructor Detail
-
Log4J2LoggingHandler
public Log4J2LoggingHandler()
Creates a new instance whose logger name is the fully qualified class name of the instance with hex dump enabled.
-
Log4J2LoggingHandler
public Log4J2LoggingHandler(io.netty.handler.logging.LogLevel level)
Creates a new instance whose logger name is the fully qualified class name of the instance.- Parameters:
level- the log level
-
Log4J2LoggingHandler
public Log4J2LoggingHandler(java.lang.Class<?> clazz)
Creates a new instance with the specified logger name and with hex dump enabled.- Parameters:
clazz- the class type to generate the logger for
-
Log4J2LoggingHandler
public Log4J2LoggingHandler(java.lang.Class<?> clazz, io.netty.handler.logging.LogLevel level)Creates a new instance with the specified logger name.- Parameters:
clazz- the class type to generate the logger forlevel- the log level
-
Log4J2LoggingHandler
public Log4J2LoggingHandler(java.lang.String name)
Creates a new instance with the specified logger name using the default log level.- Parameters:
name- the name of the class to use for the logger
-
Log4J2LoggingHandler
public Log4J2LoggingHandler(java.lang.String name, io.netty.handler.logging.LogLevel level)Creates a new instance with the specified logger name.- Parameters:
name- the name of the class to use for the loggerlevel- the log level
-
-
Method Detail
-
channelRegistered
public void channelRegistered(io.netty.channel.ChannelHandlerContext ctx) throws java.lang.Exception- Specified by:
channelRegisteredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelRegisteredin classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
channelUnregistered
public void channelUnregistered(io.netty.channel.ChannelHandlerContext ctx) throws java.lang.Exception- Specified by:
channelUnregisteredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelUnregisteredin classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
channelActive
public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws java.lang.Exception- Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
channelInactive
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) throws java.lang.Exception- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable cause) throws java.lang.Exception- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object evt) throws java.lang.Exception- Specified by:
userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
userEventTriggeredin classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
bind
public void bind(io.netty.channel.ChannelHandlerContext ctx, java.net.SocketAddress localAddress, io.netty.channel.ChannelPromise promise) throws java.lang.Exception- Specified by:
bindin interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
bindin classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
connect
public void connect(io.netty.channel.ChannelHandlerContext ctx, java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, io.netty.channel.ChannelPromise promise) throws java.lang.Exception- Specified by:
connectin interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
connectin classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
disconnect
public void disconnect(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) throws java.lang.Exception- Specified by:
disconnectin interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
disconnectin classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
close
public void close(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) throws java.lang.Exception- Specified by:
closein interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
closein classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
deregister
public void deregister(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) throws java.lang.Exception- Specified by:
deregisterin interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
deregisterin classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
channelReadComplete
public void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx) throws java.lang.Exception- Specified by:
channelReadCompletein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadCompletein classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
channelRead
public void channelRead(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
write
public void write(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg, io.netty.channel.ChannelPromise promise) throws java.lang.Exception- Specified by:
writein interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
writein classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
channelWritabilityChanged
public void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) throws java.lang.Exception- Specified by:
channelWritabilityChangedin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelWritabilityChangedin classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
flush
public void flush(io.netty.channel.ChannelHandlerContext ctx) throws java.lang.Exception- Specified by:
flushin interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
flushin classio.netty.handler.logging.LoggingHandler- Throws:
java.lang.Exception
-
-