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.
It looks like the line listed below helped me to turn off Netty logs. I don't know if it disables all possible logs from Netty, but at least those I'd already saw.
Logger.getLogger("io.netty").setLevel(Level.OFF);
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 love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With