Android logs
android_logsInspect Android app runtime output via logcat, using snapshot or bounded live capture, filter by package, tag, or priority to diagnose crashes and errors.
Instructions
Read what an Android app prints while it runs, from logcat. Two bounded modes: snapshot reads the recent persisted ring (logcat -d -v time from a start timestamp computed on the DEVICE clock, default the last 2m); follow captures live output for duration_seconds (default 10, max 60) and returns everything accumulated when the window closes — never an unbounded stream. Narrow with bundle_id (limits the capture to that package’s running process via --pid), a tag, a minimum priority, a buffer (main/system/crash/events/radio/all), and a case-sensitive literal substring grep. Output is capped at ~300 lines / 30 KB (tail kept; truncated:true plus a narrowing hint when the cap bites) — an idle emulator emits hundreds of lines a second, so narrow before widening the window. To read a crash specifically, use buffer:"crash".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tag | No | logcat tag filter, e.g. "ActivityManager" — only lines from that tag are kept (combined with priority as `<tag>:<priority> *:S`). Safe ASCII only: start alphanumeric, then alphanumeric, underscore, dot, slash, or hyphen; whitespace, colon, and asterisk are rejected. | |
| grep | No | Case-sensitive literal substring applied exactly as supplied to each captured line after the window closes; regular-expression metacharacters have no special meaning. | |
| mode | No | snapshot: the recent persisted ring (default). follow: bounded live capture for duration_seconds, then return. | |
| buffer | No | Log buffer to read (default: logcat’s own main+system+crash). Use "crash" to read only fatal Java/native crashes, "events" for system events, "all" for everything. | |
| device | No | Target adb serial. Defaults to the streamed device, else the only online one. | |
| duration | No | Snapshot window, e.g. "2m", "30s", "1h" (default "2m"). Ignored in follow mode. | |
| priority | No | Minimum priority: V(erbose) D(ebug) I(nfo) W(arn) E(rror) F(atal). Default keeps everything the buffer holds. | |
| bundle_id | No | Android package name whose process the capture is limited to, e.g. "com.example.app". Resolved to a pid with `pidof -s` and passed as --pid, so the app must be RUNNING; requires at least two ASCII dot-separated identifiers, each starting with a letter and continuing with letters, digits, or underscore. When it is not running, the tool says so and suggests grep instead of returning nothing. | |
| duration_seconds | No | Follow capture window in seconds, 1..60 (default 10; larger values are clamped). Ignored in snapshot mode. |