I am using Netty 4.1.6.
Is it possible to set netty using log4j2 as internal logger?
Eclipse prompt me that the following statement is depreciated.
InternalLoggerFactory.setDefaultFactory(new Log4J2LoggerFactory());
Would you tell me how to do so?
Thanks Ferrybig for the tip.
I am elaborating on how to do this on log4j2.
Before you do the Netty server bootstrap, insert this line above.
InternalLoggerFactory.setDefaultFactory(Log4J2LoggerFactory.INSTANCE);
ServerBootstrap b = new ServerBootstrap();
b.option(ChannelOption.SO_BACKLOG, 1024);
b.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.handler(new LoggingHandler(LogLevel.INFO))
.childHandler(new ...
Then on the log4j2.xml have the loggers and the corresponding Appenders.
<Logger name="io.netty" level="INFO" additivity="false">
<AppenderRef ref="nettyTrace"/>
</Logger>