Is it possible to also display the Log's Package Name in each line?
Using
logcat -v long
leaves exactly the package name field (after PID) empty.
I want to filter the Logs from a specific application with different Tags, just wondering if it is possible.
pid = process ID. uid = user ID of the application that owns that process.
logcat
record does not have a "package name field". Therefore there is no standard/built-in way to filter by it.
Although since Android 7.0 you can use logcat --pid
option combined with pidof -s
command to filter output by binary/package name:
adb shell "logcat --pid=$(pidof -s <package_name>)"
Replace "
with '
for Linux/MacOS
This is my script. A little rusty but still working.
PID=`adb shell ps | grep -i <your package name> | cut -c10-15`;
adb logcat | grep $PID
Actually I have a python script to add more colours, and a while loop to keep monitoring for that process when it gets restarted, but I think you'll get the point.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With