Logging different level for a specific class using logback?

Donald picture Donald · Jun 14, 2013 · Viewed 13.1k times · Source

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

Answer

Mr.Q picture Mr.Q · May 12, 2014

(In case you set the name of logger explicitly) check if the name of the logger matches the name you set for your logger in your source code.

Use the upper case letters for level keywords (DEBUG, INFO ....) and I am not sure but maybe you should use Level instead of level.