extracting-logs-with-logcat
Installation
SKILL.md
Extracting Logs With logcat — Reading Device Logs
This skill covers adb logcat end-to-end: streaming vs dumping, buffer selection, filter expressions, format flags, PID and time filters, file rotation, and the R8 rule that strips Log.d from release builds. The companion CI capture-on-failure pattern lives in ../../automation/scripting-adb-for-ci/SKILL.md.
When to use this skill
- A test fails on CI; the developer needs to dump the device log into the artefact archive.
- The developer's
adb logcat | grep MyAppis overwhelming the SSH session — the logcat-side filter is the fix. - A scenario only reproduces inside
system_serverorcrashbuffers, not the defaultmain. - The developer wants structured logs (
-v json) for machine ingestion. - A
Log.d("Sensitive", "...")call appears to leak in release — the R8-assumenosideeffectsrule is missing. - Logs disappear after the app is killed by Doze/ANR —
--pidplus a re-resolution loop is needed.
When NOT to use this skill
- Capturing a screenshot or video. Use
../../capture/capturing-screenshots-and-screenrecord/SKILL.md. - Pulling a generic file from the device. Use
../../transfer/extracting-test-artifacts/SKILL.md. - The whole script — retries, port forwarding, parallel device fan-out. Use
../../automation/scripting-adb-for-ci/SKILL.md. - Driving gestures or settings changes. Use
../../control/injecting-input-and-state/SKILL.md.