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

I observed that when i use Logcat with Eclipse with ADT for Android, I get messages from many other applications as well. Is there a way to filter this and show only messages from my own application only.

36 Answers
36

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