Can I override a logging level for a specific class only using logback.xml? i.e everything remains in INFO, except for one class which will log in DEBUG.
I appended this after the default one, but does not seem to work
<logger name="com.pack1.pack2.paack3.ClassName" additivity="false" level="debug">
<appender-ref ref="file1"/>
</logger>
Thanks, Donald
In logback-classic, filters can be added to Appender instances. By adding one or more filters to an appender, you can filter events by arbitrary criteria, such as the contents of the log message, the contents of the MDC, the time of day or any other part of the logging event.
"Root" level does not restrict levels of other loggers, it merely sets the default. So <root level="INFO"> and <logger name="some.name" level="DEBUG"> are perfectly suitable together, and you don't need to relax the "root" level. So both examples should log on debug level for logger named com.
Doing it exactly like this works for me:
<logger name="org.apache.zookeeper" level="WARN" />
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