Android Dev:在Eclipse中的Logcat -不能限制输出到V/D/I/E?

时间:2020-12-31 14:01:12

I'm using Logcat in Eclipse. I've been unable to find documentation online telling me as such, but presume that the V, D, I, E etc. buttons when clicked should restrict Logcat output to that pipeline? No matter which I select, every logcat output is spewed out, and it's making debugging nigh on impossible.

我在Eclipse中使用Logcat。我一直找不到在线文档告诉我这一点,但假设单击时V、D、I、E等按钮应该将Logcat输出限制在该管道上?无论我选择哪个,每个logcat输出都会被输出,这使得调试几乎是不可能的。

Can someone please tell me how to display only Debug output, i.e. Log.d(..) prints? I don't think this is possible using a filter, since I've tried creating one with log level 'Debug' and an empty tag and pid field, yet this simply prints all log outputs again.

能不能有人告诉我如何只显示调试输出,比如Log.d(.. ..)打印?我不认为使用过滤器可以实现这一点,因为我尝试过使用日志级别的“Debug”和空标记和pid字段创建一个过滤器,但这只是再次打印所有日志输出。

Many thanks!

很多谢谢!

UPDATE

更新

So, thanks to Aleadam's link below, I'm now aware that V/D/E/ etc. are 'priority levels' and include those priorities lower than themselves. It doesn't seem possible to restrict to only D(ebug) output, but at least I know how to restrict to D,V since V(erbose) is the only priority level lower than Debug:

因此,感谢下面Aleadam的链接,我现在意识到V/D/E/等是“优先级”,包括那些比它们本身更低的优先级。似乎不可能只限制D(ebug)输出,但至少我知道如何限制D,因为V(erbose)是唯一比Debug更低的优先级:

adb logcat *:W

Of course, this must be done via the command line, so I'm now going to figure out how to employ the same strategy in Eclipse. The buttons really aren't working for me, I've no idea why, but it's frustrating!

当然,这必须通过命令行完成,因此我现在将研究如何在Eclipse中使用相同的策略。这些按钮真的对我不起作用,我不知道为什么,但这很令人沮丧!

Many thanks for all the information you've posted, guys.

非常感谢你们发布的所有信息,伙计们。

3 个解决方案

#1


2  

Those buttons should work in the manner you're describing so long as they were logged with the appropriate API call in the Log class. http://developer.android.com/reference/android/util/Log.html

这些按钮应该以您所描述的方式工作,只要它们被日志类中的适当API调用记录下来。http://developer.android.com/reference/android/util/Log.html

Regexes/wildcards do not work. There's a bug I requested from almost a year ago. http://code.google.com/p/android/issues/detail?id=11580&can=4&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

regex /通配符不工作。有一个bug是我一年前请求的。http://code.google.com/p/android/issues/detail?id=11580&can=4&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

#2


2  

adb logcat *:D will not show only debug, but everything with debug priority or higher.

adb logcat *:D将不仅显示调试,还显示具有调试优先级或更高的所有内容。

For example, adb logcat *:E > err.log will save errors only.

例如,adb logcat *:E > err。日志只会保存错误。

For many options, check "Filtering Log Output" in here: http://developer.android.com/guide/developing/tools/adb.html#logcat

对于许多选项,请在这里检查“过滤日志输出”:http://developer.android.com/guide/developing/tools/adb.html#logcat

If you're running under linux use grep. If you're on windows, use the shell: (e.g. adb shell "logcat |grep 'D\/'")

如果您正在linux下运行,请使用grep。如果您在windows上,请使用shell:(例如,adb shell“logcat |grep 'D\/')”)

#3


1  

Filtering works on my system but I specify a Log Tag. This then creates a new button next to Log. So for Log Tag "QPR" I see [Log][QPR] buttons and when I press on [QPR] I only see logging that has been tagged as "QPR" as in Log.d(TAG,"onCreate",e);

过滤对我的系统有效,但我指定一个日志标记。然后在Log旁边创建一个新按钮。因此,对于日志标记“QPR”,我看到[Log][QPR]按钮,当我按[QPR]时,我只看到在Log.d(Tag,"onCreate",e)中标记为"QPR"的日志记录;

At least on my system if I click on [Log] (E) I only get errors.

至少在我的系统上,如果我点击[Log] (E),我只会得到错误。

Hope that helps, JAL

希望有所帮助,日航

#1


2  

Those buttons should work in the manner you're describing so long as they were logged with the appropriate API call in the Log class. http://developer.android.com/reference/android/util/Log.html

这些按钮应该以您所描述的方式工作,只要它们被日志类中的适当API调用记录下来。http://developer.android.com/reference/android/util/Log.html

Regexes/wildcards do not work. There's a bug I requested from almost a year ago. http://code.google.com/p/android/issues/detail?id=11580&can=4&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

regex /通配符不工作。有一个bug是我一年前请求的。http://code.google.com/p/android/issues/detail?id=11580&can=4&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

#2


2  

adb logcat *:D will not show only debug, but everything with debug priority or higher.

adb logcat *:D将不仅显示调试,还显示具有调试优先级或更高的所有内容。

For example, adb logcat *:E > err.log will save errors only.

例如,adb logcat *:E > err。日志只会保存错误。

For many options, check "Filtering Log Output" in here: http://developer.android.com/guide/developing/tools/adb.html#logcat

对于许多选项,请在这里检查“过滤日志输出”:http://developer.android.com/guide/developing/tools/adb.html#logcat

If you're running under linux use grep. If you're on windows, use the shell: (e.g. adb shell "logcat |grep 'D\/'")

如果您正在linux下运行,请使用grep。如果您在windows上,请使用shell:(例如,adb shell“logcat |grep 'D\/')”)

#3


1  

Filtering works on my system but I specify a Log Tag. This then creates a new button next to Log. So for Log Tag "QPR" I see [Log][QPR] buttons and when I press on [QPR] I only see logging that has been tagged as "QPR" as in Log.d(TAG,"onCreate",e);

过滤对我的系统有效,但我指定一个日志标记。然后在Log旁边创建一个新按钮。因此,对于日志标记“QPR”,我看到[Log][QPR]按钮,当我按[QPR]时,我只看到在Log.d(Tag,"onCreate",e)中标记为"QPR"的日志记录;

At least on my system if I click on [Log] (E) I only get errors.

至少在我的系统上,如果我点击[Log] (E),我只会得到错误。

Hope that helps, JAL

希望有所帮助,日航