@act262
2017-08-09T14:03:16.000000Z
字数 3141
阅读 1638
adb_shell
adb shell logcat命令映射为adb logcat
查看帮助命令adb logcat --help
logcat -f out.log
adb logcat -v time >> d:\1.txt
logcat -d直接dump出log,不阻塞logcat -c 清空log缓存
-v 指定输出格式,不同版本支持的格式有些不同
i.e.
adb logcat -v briefadb logcat -v time
# 输出所有Error的log,没有指定Tagadb logcat *:E# 输出System.out的logadb logcat System.out# 输出指定包名的logadb logcat --pid=xx# 输出指定包名的log,用于低版本adb命令,需要手动匹配出来adb logcat | grep "xxx"
C:\Users\act.zhang>adb logcat --helpUsage: logcat [options] [filterspecs]options include:-s Set default filter to silent.Like specifying filterspec '*:S'-f <filename> Log to file. Default is stdout--file=<filename>-r <kbytes> Rotate log every kbytes. Requires -f--rotate-kbytes=<kbytes>-n <count> Sets max number of rotated logs to <count>, default 4--rotate-count=<count>-v <format> Sets the log print format, where <format> is:--format=<format>brief color epoch long monotonic printable process rawtag thread threadtime time uid usec UTC year zone-D print dividers between each log buffer--dividers-c clear (flush) the entire log and exit--clear-d dump the log and then exit (don't block)-e <expr> only print lines where the log message matches <expr>--regex <expr> where <expr> is a regular expression-m <count> quit after printing <count> lines. This is meant to be--max-count=<count> paired with --regex, but will work on its own.--print paired with --regex and --max-count to let content bypassregex filter but still stop at number of matches.-t <count> print only the most recent <count> lines (implies -d)-t '<time>' print most recent lines since specified time (implies -d)-T <count> print only the most recent <count> lines (does not imply -d)-T '<time>' print most recent lines since specified time (not imply -d)count is pure numerical, time is 'MM-DD hh:mm:ss.mmm...''YYYY-MM-DD hh:mm:ss.mmm...' or 'sssss.mmm...' format-g get the size of the log's ring buffer and exit--buffer-size-G <size> set size of log ring buffer, may suffix with K or M.--buffer-size=<size>-L dump logs from prior to last reboot--last-b <buffer> Request alternate ring buffer, 'main', 'system', 'radio',--buffer=<buffer> 'events', 'crash', 'default' or 'all'. Multiple -bparameters are allowed and results are interleaved. Thedefault is -b main -b system -b crash.-B output the log in binary.--binary-S output statistics.--statistics-p print prune white and ~black list. Service is specified as--prune UID, UID/PID or /PID. Weighed for quicker pruning if prefixwith ~, otherwise weighed for longevity if unadorned. Allother pruning activity is oldest first. Special case ~!represents an automatic quicker pruning for the noisiestUID as determined by the current statistics.-P '<list> ...' set prune white and ~black list, using same format as--prune='<list> ...' printed above. Must be quoted.--pid=<pid> Only prints logs from the given pid.--wrap Sleep for 2 hours or when buffer about to wrap whichevercomes first. Improves efficiency of polling by providingan about-to-wrap wakeup.filterspecs are a series of<tag>[:priority]where <tag> is a log component tag (or * for all) and priority is:V Verbose (default for <tag>)D Debug (default for '*')I InfoW WarnE ErrorF FatalS Silent (suppress all output)'*' by itself means '*:D' and <tag> by itself means <tag>:V.If no '*' filterspec or -s on command line, all filter defaults to '*:V'.eg: '*:S <tag>' prints only <tag>, '<tag>:S' suppresses all <tag> log messages.If not specified on the command line, filterspec is set from ANDROID_LOG_TAGS.If not specified with -v on command line, format is set from ANDROID_PRINTF_LOGor defaults to "threadtime"