Filter LogCat to get only the messages from My Application in Android?

Linux and OS X

Use ps/grep/cut to grab the PID, then grep for logcat entries with that PID. Here’s the command I use:

adb logcat | grep -F "`adb shell ps | grep com.asanayoga.asanarebel  | tr -s [:space:] ' ' | cut -d' ' -f2`"

(You could improve the regex further to avoid the theoretical problem of unrelated log lines containing the same number, but it’s never been an issue for me)

This also works when matching multiple processes.

Windows

On Windows you can do:

adb logcat | findstr com.example.package

Leave a Comment