问题描述
我最近从log4j切换到logback,我想知道是否有一种简单的方法在调试模式下运行logback,类似于log4j的 log4j.debug
属性。我需要看看它从哪里拿起我的 logback.xml
。
I've recently switched from log4j to logback and am wondering if there is an easy way to run logback in debug mode, similar to log4j's log4j.debug
property. I need to see where it is picking up my logback.xml
from.
文档提到使用 StatusPrinter
打印出logback的内部状态,但这需要更改代码。
The docs mention using a StatusPrinter
to print out logback's internal status, but that would require code changes.
推荐答案
这已在Logback 1.0.4中修复。您现在可以使用 -Dlogback.debug = true
来启用对回调设置的调试。
This has been fixed in Logback 1.0.4. You can now use -Dlogback.debug=true
to enable debugging of the logback setup.
- 旧答案 -
-- Old Answer --
不幸的是,没有办法通过System属性启用调试。您必须在 logback.xml
中使用< configuration debug =true>
。请提交功能请求。
Unfortunately, there is no way to enable debugging via a System property. You have to use <configuration debug="true">
in the logback.xml
. Please submit a feature request.
这篇关于在Debug中运行Logback的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!