OneWorld
OneWorld

Reputation: 17671

Filter tags in LogCat (in Android Eclipse Plug-In)

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?

Upvotes: 21

Views: 39041

Answers (9)

Amir Uval
Amir Uval

Reputation: 14873

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:

tag:wif text:event

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 or fullword$

TIP: if you want to match a space character or a tab in your output, just type in: \s at the desired place.

Upvotes: 5

Solostaran14
Solostaran14

Reputation: 1666

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 text Choreographer

If you want multiple exclusions : tag:^(?!Choreographer|dalvikvm-heap|Trace).*$

Upvotes: 20

MapleLover
MapleLover

Reputation: 665

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

Upvotes: 1

realtebo
realtebo

Reputation: 25637

When filtering, you must use no whitespace after 'tag:' and all is case sensitive. For example:

tag:MIRKO

and not

TAG: mirko

Upvotes: 4

Rob Cranfill
Rob Cranfill

Reputation: 2324

The Log tag field accepts Java regular expressions, so try this:

^TAG_A$|^TAG_B$

which matches exactly those tags. You can go crazy with complicated regular expressions, if that's your idea of fun.

Upvotes: 13

Albus Dumbledore
Albus Dumbledore

Reputation: 12616

A sample from the ADB manual:

adb logcat ActivityManager:I MyApp:D *:S

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.:

adb logcat ActivityManager:I MyApp*:D *:S

wouldn't work.

Upvotes: 4

Scott Cheezem
Scott Cheezem

Reputation: 11

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

Upvotes: 1

Chris Stratton
Chris Stratton

Reputation: 40337

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.

Upvotes: 3

chad
chad

Reputation: 2946

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.

Upvotes: 33

Related Questions