当前位置:Gxlcms > 数据库问题 > 【LOGCAT】adb logcat -h的帮助信息

【LOGCAT】adb logcat -h的帮助信息

时间:2021-07-01 10:21:17 帮助过:2人阅读

adb logcat -h的帮助信息

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 log print 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 then exit (don‘t block)

  -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‘

  -g              get the size of the log‘s ring buffer and exit

  -b <buffer>     Request alternate ring buffer, ‘main‘, ‘system‘, ‘radio‘,

                  ‘events‘, ‘crash‘ or ‘all‘. Multiple -b parameters are

                  allowed and results are interleaved. The default is

                  -b main -b system -b crash.

  -B              output the log in binary.

  -S              output statistics.

  -G <size>       set size of log ring buffer, may suffix with K or M.

  -p              print prune white and ~black list. Service is specified as

                  UID, UID/PID or /PID. Weighed for quicker pruning if prefix

                  with ~, otherwise weighed for longevity if unadorned. All

                  other pruning activity is oldest first. Special case ~!

                  represents an automatic quicker pruning for the noisiest

                  UID as determined by the current statistics.

  -P ‘<list> ...‘ set prune white and ~black list, using same format as

                  printed above. Must be quoted.



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

  F    Fatal

  S    Silent (supress all output)



‘*‘ 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"
日志
用来在命令行中显示日志流:
adb logcat
按标签名过滤
adb logcat -s TAG_NAME
adb logcat -s TAG_NAME_1 TAG_NAME_2# exampleadb logcat -s TEST
adb logcat -s TEST MYAPP
按优先级过滤
显示指定告警优先级及以上的日志:
adb logcat "*:PRIORITY"# exampleadb logcat "*:W"
优先级设置如下:
V:Verbose (最低优先级)
D:Debug
I:Info
W:Warning
E:Error
F:Fatal
S:Silent (最高优先级, 在这个级别上不会打印任何信息))
按标签名和优先级过滤
adb logcat -s TAG_NAME:PRIORITY  
adb logcat -s TAG_NAME_1:PRIORITY TAG_NAME_2:PRIORITY` 
# example  adb logcat -s TEST: W
使用grep过滤
另外,在支持grep的系统中,logcat输出可以通过管道发送给grep:
adb logcat | grep "SEARCH_TERM"adb logcat | grep "SEARCH_TERM_1\|SEARCH_TERM_2"# exampleadb logcat | grep "Exception"adb logcat | grep "Exception\|Error"
清除logcat的缓冲区
使用这个命令来清除缓冲区,并清除旧的日志数据:
adb logcat -c


【LOGCAT】adb logcat -h的帮助信息

标签:

人气教程排行