我通过gradle/maven使用slf4j-android 1.6.1-RC1当我在模拟器中运行应用程序时,当我调用Log.debug时,在Android Studio 0.3.5下的Logcat中没有任何内容.
为了好玩,我尝试了以下方法:
private final Logger Log = LoggerFactory.getLogger(MainActivity.class);
...
Log.debug("Got this far, woohoo!");
android.util.Log.d("blah","I am here!");
Run Code Online (Sandbox Code Playgroud)
Log.d的输出确实出现在Logcat中,但Log.debug没有出现.
我检查了Log.isDebugEnabled(),确定它设置为false.但这似乎很奇怪,因为android.util.Log.d工作正常.slf4j不应该使用相同的日志级别吗?事实上,不应该slf4j只是在封面下调用android.util.Log?
我还用Log.error替换了Log.debug,这确实有效.所以问题似乎是slf4j以某种方式决定不应该发出调试事件,即使Log.d将发出它们.
如何让slf4j兑现Android Studio中Logcat设置的日志级别,如android.util.Log一样?