1

Note:
This question is a duplicate of Filter log messages by PID or application package in Android.
But there is no correct answer to that question & it is very very old.

I can't make any changes in the app codebase as suggested in the accepted answer, I can only access the app build.

As per Android Docs: https://developer.android.com/studio/command-line/logcat#alternativeBuffers
We should be able to filter logs of a given application using the command:
adb logcat --pid=<pid>

--pid= ... Only print logs from the given PID.

But I am getting an error "unrecognized option" when I enter it in cmd.

Got PID of application using:
adb shell ps <app-package-name>

Note: Want a solution without using cmd alone, not using Android Studio.

Abhimanyu
  • 11,351
  • 7
  • 51
  • 121

1 Answers1

2

For adb --pid command to work , the device/emulator in which you have tired capturing the logcat messages should atleast be Android 7.0 . Otherwise this command will not work.

if you have device with android 7.0 above , then try this command

adb logcat --pid=19816 *:D

replace your pid value and * means (any tag) : D meas DEBUG severity log messages

if you have device which is older versions , you can search specific logcat messages based on your package name string or given tag strings like this

adb logcat | findstr <PACKAGENAME OR TAGS>
Hasif Seyd
  • 1,686
  • 12
  • 19