[android] Filter output in logcat by tagname

I'm trying to filter logcat output from a real device (not an emulator) by tag name but I get all the messages which is quite a spam. I just want to read messages from browser which should be something like "browser:" or "webkit:" , but it doesn't work... Here it is what I get:

actual output

This question is related to android logcat android-logcat

The answer is


In case someone stumbles in on this like I did, you can filter on multiple tags by adding a comma in between, like so:

adb logcat -s "browser","webkit"

Another option is setting the log levels for specific tags:

adb logcat SensorService:S PowerManagerService:S NfcService:S power:I Sensors:E

If you just want to set the log levels for some tags you can do it on a tag by tag basis.


Here is how I create a tag:

private static final String TAG = SomeActivity.class.getSimpleName();
 Log.d(TAG, "some description");

You could use getCannonicalName

Here I have following TAG filters:

  • any (*) View - VERBOSE
  • any (*) Activity - VERBOSE
  • any tag starting with Xyz(*) - ERROR
  • System.out - SILENT (since I am using Log in my own code)

Here what I type in terminal:

$  adb logcat *View:V *Activity:V Xyz*:E System.out:S

Do not depend on ADB shell, just treat it (the adb logcat) a normal linux output and then pip it:

$ adb shell logcat | grep YouTag
# just like: 
$ ps -ef | grep your_proc 

Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to logcat

strange error in my Animation Drawable Android Studio - ADB Error - "...device unauthorized. Please check the confirmation dialog on your device." Couldn't load memtrack module Logcat Error sendUserActionEvent() is null Android studio logcat nothing to show Restore LogCat window within Android Studio error opening trace file: No such file or directory (2) Android Log.v(), Log.d(), Log.i(), Log.w(), Log.e() - When to use each one? How to filter Android logcat by application? Filter output in logcat by tagname

Examples related to android-logcat

Android Studio - ADB Error - "...device unauthorized. Please check the confirmation dialog on your device." Restore LogCat window within Android Studio Meaning of Choreographer messages in Logcat How to save LogCat contents to file? Filter LogCat to get only the messages from My Application in Android? Filter output in logcat by tagname Logcat not displaying my log calls