如何在slf4j Logger中启用调试? [英] How to enable debug in slf4j Logger?

查看:984
本文介绍了如何在slf4j Logger中启用调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为所有 slf4j.Logger 对象全局启用 debug

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

推荐答案

以编程方式,使用logback:

Programmatically, with logback:

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

其中

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);
}

这篇关于如何在slf4j Logger中启用调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆