Logcat & Debugging
Android 1.0+
Risk: READ_ONLY
View Android System Logs (Logcat)
Streams real-time system log messages, app traces, and crash stack traces.
Command Syntax
adb logcat
Generic Syntax:
adb logcat [options] [filterspecs]
Options & Parameters
| Flag | Description |
|---|---|
| -s | Silent mode: filter only tags explicitly specified. |
| -d | Dump log buffer to screen and exit immediately (no streaming). |
| -c | Clear (flush) the entire logcat ring buffer. |
| -f <FILE> | Write log output to specified file on device. |
| -v <FORMAT> | Set log format (time, threadtime, color, epoch, raw, json). |
| -b <BUFFER> | Select specific buffer (main, system, radio, events, crash, all). |
| --pid <PID> | Filter log entries produced by a specific process ID. |
| -g | Print the size of the ring buffer and its current utilization. |
Real-World Usage Examples
Stream all error logs (*:E)
Filters stream to only Error and Fatal priority logs.
adb logcat *:E
Output:
08-25 12:19:01.120 1420 1455 E AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.app, PID: 4120
java.lang.NullPointerException: Attempt to invoke virtual method on a null object reference
Filter logs by specific tag and priority
Shows only logs tagged MyTag (Debug+) or ActivityTaskManager (Info+).
adb logcat -s "MyTag:D" "ActivityTaskManager:I"
Output:
08-25 12:20:15.842 2100 2100 D MyTag : Network payload received: 200 OK
Filter by Process ID (PID)
Streams logs generated exclusively by process 4120.
adb logcat --pid=4120
Output:
08-25 12:20:18.910 4120 4120 I MyTag : Initializing UI controller