← 返回命令列表

Linux command

adb-logcat 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

View

adb logcat

Filter

adb logcat *:[E]

Example

adb logcat [ActivityManager]:I *:S

Clear

adb logcat -c

Example

adb logcat -b [main|system|crash|events]

Example

adb logcat -f [logfile.txt]

说明

adb logcat displays the Android system log in real-time. It shows log messages from the system, apps, and various Android components. The output includes timestamp, process ID, thread ID, priority level, tag, and message. Filter expressions allow you to select which log messages to display based on tag name and minimum priority level. Multiple filters can be combined to create complex filtering rules.

参数

-v _format_
Output format: brief, process, tag, thread, raw, time, threadtime (default), long
-b _buffer_
Log buffer: main, system, radio, events, crash, all
-c
Clear the log buffers and exit
-d
Dump log and exit (don't block)
-f _file_
Write output to file
-g
Print the size of the specified log buffer and exit
-n _count_
Set the maximum number of rotated logs (default 4, requires -r)
-r _kbytes_
Rotate log every kbytes of output (default 16, requires -f)
-s
Set default filter to silent (equivalent to *:S)
-e _regex_
Only print lines matching regex
--pid=_pid_
Only show logs from specified process ID

FAQ

What is the adb-logcat command used for?

adb logcat displays the Android system log in real-time. It shows log messages from the system, apps, and various Android components. The output includes timestamp, process ID, thread ID, priority level, tag, and message. Filter expressions allow you to select which log messages to display based on tag name and minimum priority level. Multiple filters can be combined to create complex filtering rules.

How do I run a basic adb-logcat example?

Run `adb logcat` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -v _format_ do in adb-logcat?

Output format: brief, process, tag, thread, raw, time, threadtime (default), long