https://www.cnblogs.com/JianXu/p/5468839.html
https://www.cnblogs.com/flyingcode/p/5280504.html
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)
-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.
-K dump kernel log by klogctl, this operation need super user
permission.
-B output the log in 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
F Fatal
S Silent (supress all output)
logcat [-v <format>]
格式 |
說明 |
brief | 顯示優先級/標記和過程的PID發出的消息(默認格式) |
process | 只顯示PID |
tag | 只顯示優先級/標記 |
raw | 顯示原始的日誌消息,沒有其他元數據字段 |
time | 調用顯示日期、時間、優先級/標籤和過程的PID發出消息 |
threadtime | 調用顯示日期、時間、優先級、標籤遺蹟PID TID線程發出的消息 |
long | 顯示所有元數據字段與空白行和單獨的消息 |
logcat -g 獲取日誌緩衝區的大小
130|shell@p34al:/ # logcat -g
main: ring buffer is 256Kb (250Kb consumed), max entry is 5120b, max payload is 4076b
system: ring buffer is 256Kb (76Kb consumed), max entry is 5120b, max payload is 4076b
crash: ring buffer is 256Kb (993b consumed), max entry is 5120b, max payload is 4076b
logcat -G size 設置緩衝區的大小
logcat -G 3M
//舉例子:
logcat -v threadtime
logcat -v time |grep -i -E 'assist|RECORD_START' //支持正則表達式
logcat -v threadtime *:E //查看優先級爲Error的所有日誌
logcat -s WindowManager |grep -i VOICE
logcat -s FunRemoteService FunRemoteReceiver FunUtils StatisticService