How to filter Android logcat by application?
According to http://developer.android.com/tools/debugging/debugging-log.html:
Here's an example of a filter expression that suppresses all log messages except those with the tag "ActivityManager", at priority "Info" or above, and all log messages with tag "MyApp", with priority "Debug" or above:
adb logcat ActivityManager:I MyApp:D *:S
The final element in the above expression, *:S, sets the priority level for all tags to "silent", thus ensuring only log messages with "View" and "MyApp" are displayed.
- V — Verbose (lowest priority)
- D — Debug
- I — Info
- W — Warning
- E — Error
- F — Fatal
- S — Silent (highest priority, on which nothing is ever printed)
Hi I got the solution by using this :
You have to execute this command from terminal. I got the result,
adb logcat | grep `adb shell ps | grep com.package | cut -c10-15`
I am working on Android Studio, there is a nice option to get the message using package name. On the "Edit Filter Configuration" you can create a new filter by adding your package name on the "by package name".
Edit: The original is below. When one Android Studio didn't exist. But if you want to filter on your entire application I would use pidcat for terminal viewing or Android Studio. Using pidcat instead of logcat then the tags don't need to be the application. You can just call it with pidcat com.your.application
You should use your own tag, look at: http://developer.android.com/reference/android/util/Log.html
Like.
Log.d("AlexeysActivity","what you want to log");
And then when you want to read the log use>
adb logcat -s AlexeysActivity
That filters out everything that doesn't use the same tag.