调试技巧adb

调试技巧:保存log并同时打印屏幕
打印log命令
adb logcat -v threadtime
只能输出到屏幕

如果同时想输出屏幕并保存log回看,可以用"tee"做管道输出:
adb logcat -v threadtime | tee backup.log | grep ‘MediaPlayerService.*notify\|NuPlayer\|LiveSession‘
上面的命令在屏幕输出和MediaPlayerService, NuPlayer, LiveSession相关的log,并保存到文件backup.log里

可以写成bash脚本:
my_logcat.sh
#!/bin/sh
if [ -z "$1" ]; then
FILENAME="Log"$(date +%m%d.%H%M.logcat)
else
FILENAME=$1
fi
echo $FILENAME

adb logcat -c
adb logcat -v threadtime | tee $FILENAME

平时的用法:
./my_logcat.sh out.logcat | grep ‘MediaPlayerService.*notify\|NuPlayer\|LiveSession‘

调试技巧adb

上一篇:The server time zone value ‘�й���׼ʱ��‘ is unrecognized or represents more than one time zone......


下一篇:【原创·总结】影响sql查询性能的因素