Android LogCat Filter for multiple tags in Eclipse

Androider picture Androider · Feb 12, 2011 · Viewed 24.9k times · Source

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?

Answer

Idolon picture Idolon · Sep 28, 2012

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

Screenshot

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