在Eclipse中多个标签的Andr​​oid LogCat中滤波器多个、滤波器、标签、Eclipse

2023-09-04 23:46:31 作者:坠落.

点击创建过滤器无法从文档中找出如何创造说两或多个标签过滤器。如果我有两个标签 com.test.TestClassA com.test.TestClassB 如何创建一个过滤器,显示日志对于这两个类的?我看到了如何启动亚行只有特定的标签,但如何能在eclipse这样做吗?请提供详细的感谢。究竟是什么,我需要在标签上线进入Eclipse中创建一个新的过滤器时,?

解决方案

随着指出通过脑莱因霍尔德您可以将标签过滤器与竖线 | (这显然意味着逻辑或)。您也可以使用,在logcat的搜索框(以及其他的正则表达式)语法(由preceding标签与标签: preFIX):

标签:com.test.TestClassA | com.test.TestClassB

更复杂的过滤也是可能的。例如,下面是搜索过滤器,显示无论从 android.process.media com.android.camera 应用程序的消息,其中至少有一个数字( \ D )的消息文本,并标记为 dalvikvm AndroidRuntime 标签:

应用程序:android.process.media | com.android.camera标签:dalvikvm | AndroidRuntime文本:\ D

一个短期的和有用的过滤器是标签:^(?!dalvikvm)这将删除所有这些嘈杂的Dalvik日志。

另外值得一提的是,您可以快速放置竖线在您希望禁用部分的结尾(例如:配售禁用任何部分过滤器|后应用程序:android.process.media | com.android.camera 在上面的例子中可以有效地禁用应用程序名称过滤,同时还preserving过滤通过标签和文字)

Clicked on create filter could not figure out from docs how to create a filter for say two or more tags. If I have two tags com.test.TestClassA and com.test.TestClassB how do I create a filter that shows log for both of these classes? I saw how you can start ADB for only certain tags, but how can this be done in eclipse? Please provide details thanks. What exactly do I need to enter on the tag line when creating a new filter in eclipse?

解决方案

As pointed by Brain Reinhold you can combine tag filters with vertical bar | (which obviously means logical "OR"). You can also use that (as well as other Regex) syntax in the logcat search box (by preceding tags with tag: prefix):

tag:com.test.TestClassA|com.test.TestClassB

More complex filtering is also possible. For example here is the search filter that displays messages from either android.process.media or com.android.camera apps, which have at least one digit (\d) in the message text and are tagged with either dalvikvm or AndroidRuntime tags:

app:android.process.media|com.android.camera tag:dalvikvm|AndroidRuntime text:\d

One short and useful filter is tag:^(?!dalvikvm) which removes all those noisy Dalvik logs.

It's also worth mentioning that you can quickly disable any part of the filter by placing vertical bar at the end of the part you wish to disable (e.g. placing | right after app:android.process.media|com.android.camera in the example above effectively disables filtering by application name while still preserving filtering by tags and text).