How to disable logs in Netty 4?

Viewed 8778

How can I disable all logs Netty 4 does with log4j? I actually want to write all logs by myself and see only in logs only what I wrote there. I'm new to both Netty and log4j.

3 Answers

The answer by @DWand did not work for me, but something similar did work in the case of Hibernate:

Logger.getLogger("org.hibernate").setLevel(...)

For Netty, I simply used a class-based config, and set a name filter to the log handler along with some other conditions:

handler.setFilter(record -> !record.getLoggerName().startsWith("io.netty"))

I am not sure if this is a good way to do it, but this was the only way I could skip only Netty logs.

If you work with

src/main/resources/log4j.properties

Add

log4j.logger.io.netty=OFF
Related