标签:io 文件 on c log ad r as file
调试技巧:保存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‘
标签:io 文件 on c log ad r as file
原文地址:http://www.cnblogs.com/fireflyxml/p/3992190.html