0

I tried all answers at How to filter Android logcat by application? but some of them only work when the app is running, or some require logging in to the device via shell.

If I run those commands before my app is running, I get the entire log output because there's no PID for my app yet. Example:

adb logcat | grep `adb shell ps | grep com.package | cut -c10-15`

requires the app to be already running, but I'm trying to debug something that happens 0.1s after the app starts and then it crashes. Also, if I restart the app, I can't see anything anymore as the PID changes.

And for some other answers, they are for a specific tag:

adb logcat ActivityManager:I MyApp:D *:S

but my app is crashing with some output, the crash does not come from a Log.d

I want to see all the Log.d calls from my app, but also the crashes and other stuff not printed by Log.d, but by my app, just as Android Studio can do somehow.

Rafaelo
  • 33
  • 1
  • 15
  • You may want to explain what your app does/how it was written/what your app should be doing prior to the crash. The assumption for `Log.d` is a normal Java/Kotlin Android app, but other third-party frameworks or additional C/C++ libraries may be the cause. In those cases, recording and reviewing the full logcat may be the only option. – Morrison Chang May 17 '22 at 22:19
  • @MorrisonChang indeed, the crash is because of native code. What about having a perpetual logcat to my app then, only for Log.d calls? I can't even see those, as the PID restarts on every apk send of the app – Rafaelo May 18 '22 at 00:03
  • log to a file (local or remote) and analyze later, i.e. `adb logcat > file` – Diego Torres Milano May 18 '22 at 00:40
  • As far as I know AS filters logcat by the selected PID, so effectively this would be the answer: https://stackoverflow.com/a/48004086/150978 But of course the PID changes every time you start the app. AS monitors process creation and updates the filtered PID. – Robert May 18 '22 at 07:48

0 Answers0