Android 查看指定应用的日志

5,408 阅读1分钟

以查看包名为 com.test 的应用日志为例

Step 1

使用 adb shell ps 查询得到应用进程号 PID 为 16180。如果进程过多,可以使用 adb shell ps | grep com.test 直接过滤出结果

$ adb shell ps
USER      PID   PPID  VSIZE  RSS   WCHAN            PC  NAME
root      1     0     2052   860   SyS_epoll_ 00000000 S /init
root      2     0     0      0       kthreadd 00000000 S kthreadd
root      3     2     0      0     smpboot_th 00000000 S ksoftirqd/0
root      5     2     0      0     worker_thr 00000000 S kworker/0:0H
root      6     2     0      0     msm_mpm_wo 00000000 D kworker/u8:0
u0_a327   16180 563   1303504 139472 SyS_epoll_ 00000000 S com.test

Step 2

使用 adb logcat | grep 16180 过滤出该应用的日志