1. 程式人生 > >android logcat

android logcat

adb -s 8e3ee4659904 shell logcat --h
Option -m needs an argument
Usage: logcat [options] [filterspecs]
options include:
  -s              Set default filter to silent. Equivalent to filterspec '*:S'
  -f <file>, --file=<file>               Log to file. Default is stdout
  -r <kbytes>, --rotate-kbytes=<kbytes>
                  Rotate log every kbytes. Requires -f option
  -n <count>, --rotate-count=<count>
                  Sets max number of rotated logs to <count>, default 4
  -v <format>, --format=<format>
                  Sets the log print format, where <format> is:
                    brief color epoch long monotonic printable process raw
                    tag thread threadtime time uid usec UTC year zone
  -D, --dividers  Print dividers between each log buffer
  -c, --clear     Clear (flush) the entire log and exit
                  if Log to File specified, clear fileset instead
  -d              Dump the log and then exit (don't block)
  -e <expr>, --regex=<expr>
                  Only print lines where the log message matches <expr>
                  where <expr> is a regular expression
  -m <count>, --max-count=<count>
                  Quit after printing <count> lines. This is meant to be
                  paired with --regex, but will work on its own.
  --print         Paired with --regex and --max-count to let content bypass
                  regex 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, --buffer-size                      Get the size of the ring buffer.
  -G <size>, --buffer-size=<size>
                  Set size of log ring buffer, may suffix with K or M.
  -L, -last       Dump logs from prior to last reboot
  -b <buffer>, --buffer=<buffer>         Request alternate ring buffer, 'main',
                  'system', 'radio', 'events', 'crash', 'default' or 'all'.
                  Multiple -b parameters or comma separated list of buffers are
                  allowed. Buffers interleaved. Default -b main,system,crash.
  -B, --binary    Output the log in binary.
  -S, --statistics                       Output statistics.
  -p, --prune     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.
  -C              colored output
  -P '<list> ...', --prune='<list> ...'
                  Set prune white and ~black list, using same format as
                  listed above. Must be quoted.
  --pid=<pid>     Only prints logs from the given pid.
  --wrap          Sleep for 2 hours or when buffer about to wrap whichever
                  comes first. Improves efficiency of polling by providing
                  an 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    Info
  W    Warn
  E    Error
  F    Fatal
  S    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_LOG
or defaults to "threadtime"
 

 

adb -s 8e3ee4659904 shell logcat—h
選項m需要一個引數
用法:logcat[選項][filterspecs]
選項包括:
-s設定預設過濾器為靜音。相當於filterspec '*:S'
-f <file>,——file=<file> Log to file。預設是stdout
- r < kbytes >,rotate-kbytes = < kbytes >
每千位元組旋轉日誌。需要- f選項
- n <統計>,rotate-count = <統計>
設定旋轉日誌的最大數量為<count>,預設值為4
- v <格式>,格式= <格式>
設定日誌列印格式,其中<format>為:
簡單的顏色曆元長單調的可印刷工藝
標籤執行緒執行緒時間uid usec UTC年區
-D,——分隔符在每個日誌緩衝區之間列印分隔符
清除(重新整理)整個日誌並退出
如果指定了Log to File,則清除fileset
-d轉儲日誌,然後退出(不要阻塞)
- e < expr >,regex = < expr >
只打印日誌訊息匹配<expr>的行
<expr>在哪裡是正則表示式
- m <統計>,max-count = <統計>
列印<count>行後退出。這是註定的
與-regex配對,但將自行工作。
-列印匹配-regex和-max-count,讓內容繞過
regex過濾器,但仍然停留在匹配的數量。
-t <count>僅列印最近的<count>行(暗示-d)
-t '<time>'列印自指定時間以來的最新行(暗示-d)
-T <count>僅列印最近的<count>行(並不表示-d)
-T '<time>'列印自指定時間以來的最新行(不含-d)
計數是純粹的數字,時間是' mm - dd hh:mm:ss.mmm…
“YYYY-MM-DD hh:mm:ss.mmm……”或“sssss.mmm……的格式
-g, -buffer-size獲取迴圈緩衝區的大小。
- g <大小>,緩衝區大小= <大小>
設定日誌環緩衝區的大小,可以以K或M為字尾。
-L, -上次重新引導之前的轉儲日誌
-b <buffer>, -buffer=<buffer>請求備用迴圈緩衝區,'main',
“系統”、“廣播”、“事件”、“崩潰”、“預設”或“全部”。
多個-b引數或逗號分隔的緩衝區列表是
允許的。緩衝區交錯。預設- b主要、系統崩潰。
-B, -二進位制輸出以二進位制表示的對數。
-S,——統計資料輸出統計資料。
-p, -修剪印刷,修剪白色和黑色列表。服務被指定為
UID, UID/PID或/PID。權衡為更快的修剪如果字首
如果不加修飾,則用~表示長壽。所有
其他修剪活動是最早的。特殊情況~ !
代表對噪音最大的自動快速修剪
由當前統計資料確定的UID。
- c彩色輸出
- p ' <列表>…”,——修剪= ' <列表>……”
設定修剪白色和~黑色列表,使用相同的格式
上面列出的。必須引用。
—pid=<pid>僅從給定的pid列印日誌。
——把睡眠時間包2小時,或者當緩衝器即將結束的時候
是第一位的。通過提供,提高輪詢的效率
一個about-to-wrap喚醒。

過濾規格是一系列
<標記>(優先順序):

其中<tag>是一個日誌元件標籤(或* for all),優先順序為:
V詳細(<標籤>的預設值)
D除錯(預設為'*')
我的資訊
W警告
E錯誤
F致命
靜音(抑制所有輸出)

'*'本身表示'*:D', <tag>本身表示<tag>:V。
如果命令列上沒有'*' filterspec或-s,所有過濾器預設為'*:V'。
例如:'*:S <tag>'只輸出<tag>', ' tag>:S'壓制所有<tag>日誌訊息。

如果沒有在命令列中指定,filterspec將從ANDROID_LOG_TAGS中設定。

如果命令列上沒有指定-v,則從ANDROID_PRINTF_LOG中設定format
或者預設為“threadtime”