Closed satoshinm closed 7 years ago
io/github/satoshinm/WebSandboxMC/dep/io/netty/handler/logging/LoggingHandler.java
166: this.logger.log(this.internalLevel, this.format(ctx, "RECEIVED", msg));
and/or here:
resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java
907: logger.debug("{} RECEIVED: [{}: {}], {}", ch, queryId, res.sender(), res);
if (logger.isDebugEnabled()) {
logger.debug("{} RECEIVED: [{}: {}], {}", ch, queryId, res.sender(), res);
}
why is isDebugEnabled()
?
https://stackoverflow.com/questions/20734847/how-to-disable-logs-in-netty-4 suggests:
Logger.getLogger("io.netty").setLevel(Level.OFF);
Note this is not the only logging:
20:19:02 [INFO] [id: 0x1137c456] REGISTERED
20:19:02 [INFO] [id: 0x1137c456] BIND: 0.0.0.0/0.0.0.0:4081
20:19:02 [INFO] [WebSandboxMC] Open your web browser and navigate to http://127.0.0.1:4081/ or http://localhost:4081/
20:19:02 [INFO] [id: 0x1137c456, L:/0:0:0:0:0:0:0:0:4081] ACTIVE
LoggingHandler.java has many logs:
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
if(this.logger.isEnabled(this.internalLevel)) {^M
this.logger.log(this.internalLevel, this.format(ctx, "REGISTERED"));^M
}^M
^M
ctx.fireChannelRegistered();^M
}
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
if(this.logger.isEnabled(this.internalLevel)) {^M
this.logger.log(this.internalLevel, this.format(ctx, "RECEIVED", msg));^M
}^M
^M
ctx.fireChannelRead(msg);^M
}
Why isEnabled(this.internalLevel)? https://stackoverflow.com/questions/9852473/how-to-configure-netty-logger-factory-in-order-to-see-the-output-of-logginghandl#14019881 says:
InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory()); should be executed right on the entry point of your program. Sometimes this "entry point" may be very hard to determine.
WebSocketServerThread.java sets a LoggingHandler with LogLevel.INFO:
b.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.handler(new LoggingHandler(LogLevel.INFO))
.childHandler(new WebSocketServerInitializer(sslCtx, this,
settings.pluginDataFolder));
the default level is DEBUG, omit it to avoid logging as INFO?
--- a/src/main/java/io/github/satoshinm/WebSandboxMC/ws/WebSocketServerThread.java
+++ b/src/main/java/io/github/satoshinm/WebSandboxMC/ws/WebSocketServerThread.java
@@ -109,7 +109,7 @@ public final class WebSocketServerThread extends Thread {
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
- .handler(new LoggingHandler(LogLevel.INFO))
+ .handler(new LoggingHandler())
.childHandler(new WebSocketServerInitializer(sslCtx, this,
settings.pluginDataFolder));
works to suppress the logging, but note there isn't any other logging for when a new web client connects, so may want to expand on this first.
Can this be disabled? Seems maybe to be coming from within Netty?
Added
netty_log_info
boolean, default false to use Netty log level DEBUG, can be set to true to re-enable INFO level