shell@android:/ $ logcat --help logcat --help Usage: logcat [options] [filterspecs] options include: -s Set default filter to silent. Like specifying filterspec '*:s' -f <filename> Log to file. Default to stdout -r [<kbytes>] Rotate log every kbytes. (16 if unspecified). Requires -f -n <count> Sets max number of rotated logs to <count>, default 4 -v <format> Sets the logprint format, where <format> is one of:
brief process tag thread raw time threadtime long
-c clear (flush) the entire log and exit -d dump the log and thenexit (don't block) -t <count> print only the most recent <count> lines (implies -d) -g get the size of the log's ring buffer and exit -b <buffer> Request alternate ring buffer, 'main', 'system', 'radio' or 'events'. Multiple -b parameters are allowed and the results are interleaved. The default is -b main -b system. -B output the login binary
filterspecs are a series of <tag>[:priority]
where <tag> is a log component tag (or * for all) and priority is: V Verbose D Debug I Info W Warn E Error A Assert
'*' means '*:d' and <tag> by itself means <tag>:v
If not specified on the commandline, filterspec is set from ANDROID_LOG_TAGS. If no filterspec is found, filter defaults to '*:I'
If not specified with -v, format is set from ANDROID_PRINTF_LOG or defaults to "brief"
-b <buffer> 用于指定要操作的日志缓冲区:system,events,radio,main.系统默认的是system和main 。该选项可以出现多次,以指定多个日志缓冲区。例: adb logcat -b system -b main -b events -b radio -s MyActivity:i 日志输出会指明当前查看的日志缓冲区如: --------- beginning of /dev/log/radio --------- beginning of /dev/log/events --------- beginning of /dev/log/system --------- beginning of /dev/log/main
-v <format> 设置log打印格式 brief — 显示prority/tag,产生日志的进程ID,和日志消息(默认格式)。 process — 显示priority,产生日志的进程ID,和日志消息 tag — 显示prority/tag,和消息 thread — 显示priority,线程ID和日志消息 raw — 只显示消息 time — 显示日期时间,priority/tag,产生日志的进程Id,和日志消息 long — 显示所有信息,日志消息另起一行显示,且每个日志间空一行
log文件抓取方式
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#实时打印 logcat main # APP日志 logcat radio # 射频通话部分日志 logcat events # 系统事件日志 logcat system # 系统日志 tcpdump # 网络通信方面log抓取 QXDM #高通平台有,主要是Modem射频网络相关的log,同radio但更强大,没怎么接触,不熟悉