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

adb logcat -h的幫助信息shell

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
相關文章
相關標籤/搜索