How to enable debug in slf4j Logger?

missingfaktor picture missingfaktor · Jun 1, 2012 · Viewed 89.5k times · Source

How to globally enable debug for all the slf4j.Logger objects?

Answer

assylias picture assylias · Jun 1, 2012

Programmatically, with logback:

setLoggingLevel(ch.qos.logback.classic.Level.DEBUG);

where

public static void setLoggingLevel(ch.qos.logback.classic.Level level) {
    ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
    root.setLevel(level);
}