问题描述
我有一点点困难配置的Android日志记录。下面是我的code是这样的:
I'm having a little difficulty configuring Android logging. Here's what my code looks like:
if (Log.isLoggable("MY_TAG", Log.VERBOSE)) {
Log.v("MY_TAG", "Here's a log message");
}
pretty的简单吧?
Pretty simple, right?
不过,我有相当多的困难得到了 Log.isLoggable(MY_TAG,Log.VERBOSE)
返回true。
However, I'm having quite a bit of difficulty getting the Log.isLoggable("MY_TAG", Log.VERBOSE)
to return true.
每http://developer.android.com/reference/android/util/Log.html,我尝试添加一个local.prop文件到/ data /目录,看起来像这样:
Per http://developer.android.com/reference/android/util/Log.html, I tried adding a local.prop file to the /data/ directory which looks like this:
log.tag.MY_TAG=VERBOSE
但没有运气。我也尝试过:
but no luck. I also tried:
System.setProperty("log.tag.MY_TAG", String.valueOf(Log.VERBOSE));
但是,这并不管用。
but that doesn't work either.
这是我在做什么错在这里的任何想法?我运行的是Android 2.1 UPDATE1上的Nexus 1,如果有什么差别。
Any ideas on what I'm doing wrong here? I'm running Android 2.1-update1 on a Nexus 1 if that makes any difference.
推荐答案
尝试
adb shell setprop log.tag.MyAppTag VERBOSE
这篇关于Android的日志记录级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!