LogCat 中的过滤标签(在 Android Eclipse 插件中)
LogCat 输出下方有一个文本字段“过滤器”。但是,它似乎只过滤消息列。我也想过滤标签。因为那里有我的班级名字。
我怎样才能实现它?
There is a TextField "Filter" below the LogCat output. However, it seems to filter only the Message-column. Id like to filter Tags also. Because there are my class names.
How can I achieve it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
日志猫窗口的右上角有一个看起来像绿色+的按钮,如果将鼠标悬停在它上面,弹出窗口中会显示“创建过滤器”,您可以通过日志标签进行过滤。它会在 log cat 中使用您指定的过滤器名称创建一个新选项卡。然后,该标签的所有输出都将转到该选项卡,而不是“日志”选项卡。
There's a button that looks like a green + in the upper right of the log cat window, if you mouse over it says "Create Filter" in the popup from that you can filter by log tag. It creates a new tab in log cat with the filter name you specified. Then all of the output of that tag will go to that tab and not the "Log" tab.
在 Eclipse 中,如果我想排除那些烦人的 Choreographer 消息,我在 logcat 过滤器 TextField 中编写此过滤器:
tag:^(?!Choreographer).*$
并且它排除了标记开头的所有消息带有文本Choreographer
如果您想要多个排除:
tag:^(?!Choreographer|dalvikvm-heap|Trace).*$
In Eclipse, if I would like to exclude those annoying Choreographer messages,I write this filter in the logcat filter TextField :
tag:^(?!Choreographer).*$
and it excludes all messages which tag starts with the textChoreographer
If you want multiple exclusions :
tag:^(?!Choreographer|dalvikvm-heap|Trace).*$
Log tag
字段接受 Java 正则表达式,因此请尝试以下操作:它与这些标记完全匹配。如果您觉得有趣的话,您可以对复杂的正则表达式感到疯狂。
The
Log tag
field accepts Java regular expressions, so try this:which matches exactly those tags. You can go crazy with complicated regular expressions, if that's your idea of fun.
老问题,但仍然相关,并且在此处的答案中没有看到这个答案。
要按 logcat 文本字段中的多列进行过滤,只需在正则表达式和列标题之间使用
空格
小写后跟:
将正则表达式分配给该列,而不是默认的“text:”
例如:
空格 '
' 是用作 AND 参数。
没有空格的单个“
|
”是一个OR。关于我在这里看到的评论之一 - 确实不需要通配符,因为它在过滤器文本之前和之后自动应用。
如果不需要通配符,可以使用正则表达式语法来限制字符串。
例如:
^starswith
或fullword$
提示: 如果您想在输出中匹配空格字符或制表符,只需输入:
\s
位于所需位置。Old question, but still relevant, and didn't see this answer among the answers here.
To filter by multiple columns in logcat textfield, simply use a
space
between regular expressions, and the column title in lower case followed by:
to assign the regex to that column instead of the default "text:"
for example:
a space '
' is used as an AND argument.
a single '
|
' without space is an OR.Regarding one of the comments I've seen here - There is no realy need for a wildcard, since it is automatically applied before and after the filter text.
If you don't want wildcard, you can use regular expression syntax to restrict the string.
for example:
^starswith
orfullword$
TIP: if you want to match a space character or a tab in your output, just type in:
\s
at the desired place.ADB 手册中的示例:
*:S
至关重要,因为这会抑制与我们指定的标签不同的其他标签。不幸的是,不能在名称中使用通配符,即:
不起作用。
A sample from the ADB manual:
The
*:S
is vital as this would suppress other tags different than the ones specified by us.Unfortunately, one can't use wildcards in the names, i.e.:
wouldn't work.
过滤时,“tag:”后不能使用空格,并且全部区分大小写。例如:
而不是
When filtering, you must use no whitespace after 'tag:' and all is case sensitive. For example:
and not
在 shell 中运行 logcat 并通过 grep 进行管道传输。
甚至可能有一种方法可以从捕获输出的 Eclipse 窗口执行此操作。
Run logcat in a shell and pipe it through grep.
There's probably even a way to do execute this from an eclipse window that would capture the output.
这在所有平台上应该是相同的,但我专门在 Mac Snow leopard、helios... 上
使用最新的 eclipse 和 android 插件执行此操作,转到 window ->;显示视图->安卓-> logcat
然后在视图的右上角有过滤按钮:“V”“D”“I”“W”“E”然后 + 编辑并 -
单击 + 并输入您的标签,或者 pid
享受过滤日志猫
this should be the same across all platforms, but I'm specifically doing this on Mac Snow leopard, helios....
with the latest eclipse and android plugin, go to window -> show view -> android -> logcat
then in the upper right corner of the view there are filter buttons : "V" "D" "I" "W" "E" then a + edit and -
click on the + and type in your tag, or pid
enjoy filtered logCat
在 LogCat 的搜索文本框中,您将看到提示文本“搜索消息,接受 Java 正则表达式,前缀为 pid:、app:、tag: 或 text: 以限制范围”。
因此只需输入标签:YOUR_TAG_NAME
In LogCat's search textbox, you will see the hint text "Search for messages, Accepts Java regexes, Prefix with pid:, app:, tag: or text: to limit scope."
So just type in tag:YOUR_TAG_NAME