1. 手机无线连接电脑
adb tcpip 5555
adb connect 192.168.100.114:5555
2. 日志抓取
1) adb logcat -v time -s xxx *:d > d:log.txt
打印出标签带"xxx"的debug日志到log.txt
2) adb logcat - v time | findstr "xxx" > d:log.txt
只将带"xxx"的信息打印出来
3) adb logcat -v time -f /sdcard/log.txt (手机通过usb线连着电脑抓取)
adb logcat -v time -f /sdcard/log.txt & (后台抓log:即手机和电脑断开连接时,也能抓取)
4) 后台抓取log断开:
搜索logcat_pid,
adb shell kill -9 logcat_pid
3. 日志检索与定位:
1) 检索:
cat xxxx.log | grep -a -n -5 'xxxx'
cat xxxx | tail -n +1897796 | head -n 500
sed -n '9839599,9839799p' xxxx.log