# Definition of logcat
The following table describes the command line options of logcat
.
Option | Description |
---|---|
-b <buffer> | Loads an alternate log buffer for viewing, such as events or radio . The main buffer is used by default. See Viewing Alternative Log Buffers. |
-c | Clears (flushes) the entire log and exits. |
-d | Dumps the log to the screen and exits. |
-f <filename> | Writes log message output to <filename> . The default is stdout . |
-g | Prints the size of the specified log buffer and exits. |
-n <count> | Sets the maximum number of rotated logs to <count> . The default value is 4. Requires the-r option. |
-r <kbytes> | Rotates the log file every <kbytes> of output. The default value is 16. Requires the -f option. |
-s | Sets the default filter spec to silent. |
-v <format> | Sets the output format for log messages. The default is brief format. For a list of supported formats, see Controlling Log Output Format. |
# logcat 会用到的设备节点
$ adb logcat -g
/dev/log/main: ring buffer is 256Kb (255Kb consumed), max entry is 5120b, max payload is 4076b
/dev/log/system: ring buffer is 256Kb (255Kb consumed), max entry is 5120b, max payload is 4076b
# logcat filter
我需要logcat打印处verbose,tag为ActivityManager的log。
$ adb shell logcat -s ActivityManager:V
# logcat log to file
# logcat set the log print format
# logcat clear (flush) the entire log and exit
# logcat request alternate ring buffer ('main', 'system', 'radio', or 'events')
# logcat