Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android LogCat Filter for multiple tags in Eclipse

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?

like image 639
Androider Avatar asked Feb 12 '11 09:02

Androider


2 Answers

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

like image 140
Idolon Avatar answered Oct 11 '22 15:10

Idolon


In the latest version of the SDK for Eclipse which now shows two versions for logcat (one deprecated); in the undeprecated version one can combine filters using OR bars: |.

For example when clicking on the + and bringing up a dialog to create a new filter, give your filter a name and then in one of the fields (for example TAG) enter com.lampreynetworks|Bluetooth and you will see output for all tags containing com.lampreynetworks and Bluetooth. The '*' is implicit here as if any part of the TAG contains any of that text it will be displayed. Also note, there must be no spaces between the OR bars!

I have not tried combining the 'by TAG' and 'by (some other option)' but somehow I have a feeling that will not work.

like image 26
Brian Reinhold Avatar answered Oct 11 '22 13:10

Brian Reinhold