logcat常用选项
adb logcat -help #查看帮助
adb logcat #常规显示
adb logcat -c #清除日志
adb logcat -G 256M #修改缓冲区大小为256M
adb logcat -v time #设置不同的显示格式
adb logcat -v color #带颜色的显示
根据tag过滤日志
adb logcat -s xxx #相当于搜索带有xxx的日志信息。注意:对中文的搜索有问题
示例:
C:\Users\hack2xia>adb logcat | findstr hack2xia
03-21 10:17:14.913 24326 24326 D hack2xia: 测试输出
C:\Users\hack2xia>adb logcat | findstr 输出
根据pid过滤日志
C:\Users\hack2xia>adb shell
lmi:/ $ ps -A | grep test
u0_a402 24326 868 6410744 101572 0 0 S com.example.test
lmi:/ $ exit
C:\Users\hack2xia>adb logcat | findstr 24326
03-21 10:17:14.713 868 868 D Zygote : Forked child process 24326
03-21 10:17:14.716 1847 1994 D PerfImpl: perfColdLaunchBoost: com.example.test, 24326, 101
03-21 10:17:14.717 1847 1994 I ActivityManager: Start proc 24326:com.example.test/u0a402 for pre-top-activity {com.example.test/com.example.test.MainActivity} caller=others
...
浙公网安备 33010602011771号