Linux command
logcat 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
View all logs
adb logcat
Filter by tag
adb logcat -s [TAG]
Filter by priority
adb logcat "*:[E]"
Clear log buffer
adb logcat -c
Output to file
adb logcat > [logfile.txt]
Show specific buffer
adb logcat -b [main,system,crash]
Format output
adb logcat -v [time]
说明
logcat displays Android system and application logs. It connects to an Android device or emulator via adb and streams log messages for debugging and analysis. The tool supports filtering by tag, priority level, and buffer type. It's essential for Android development and troubleshooting.
参数
- -s _tag_
- Filter to specific tag(s).
- -b _buffer_
- Log buffer (main, system, radio, events, crash).
- -c
- Clear log buffer.
- -d
- Dump log and exit.
- -f _file_
- Write to file.
- -v _format_
- Output format (brief, time, long, color).
- -t _count_
- Print last N lines.
- -g
- Get buffer size.
- --pid _pid_
- Filter by process ID.
FAQ
What is the logcat command used for?
logcat displays Android system and application logs. It connects to an Android device or emulator via adb and streams log messages for debugging and analysis. The tool supports filtering by tag, priority level, and buffer type. It's essential for Android development and troubleshooting.
How do I run a basic logcat example?
Run `adb logcat` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -s _tag_ do in logcat?
Filter to specific tag(s).