logcat
displays Android system and application logs
TLDR
SYNOPSIS
adb [shell] logcat [options] [filterspec...]
DESCRIPTION
logcat displays Android system and application logs. It runs on the device and is usually invoked from a host through adb logcat, which is shorthand for adb shell logcat.Messages are read from the ring buffers kept by the logd daemon. Each message has a tag and a priority, and filter specifications of the form tag[:priority] select what is printed. A bare tag means tag:V, and a bare `*` means `*:D`. If no filterspec is given, $ANDROID_LOG_TAGS is used.Available options depend on the Android version of the device; run adb logcat --help for the exact list.
PARAMETERS
-s
Set the default filter to silent (like `*:S`). Combined with tags, only those tags are shown.-b, --buffer buffer
Ring buffer(s) to read: main, system, radio, events, crash, default, all (plus kernel and security on some builds). Repeatable or comma separated. Default is main,system,crash.-c, --clear
Clear (flush) the selected buffers and exit.-d
Dump the log and exit instead of blocking.-L, --last
Dump logs from before the last reboot (pstore).-f, --file file
Write to file instead of stdout.-r, --rotate-kbytes N
Rotate the log file every N KiB (requires -f).-n, --rotate-count N
Maximum number of rotated logs (default 4).-v, --format format
Output format: brief, long, process, raw, tag, thread, threadtime (default), time. Modifiers: color, descriptive, epoch, monotonic, printable, uid, usec, UTC, year, zone.-D, --dividers
Print dividers between log buffers.-B, --binary
Output the log in binary.-e, --regex expr
Only print lines matching an ECMAScript regex.-m, --max-count N
Exit after printing N lines.-t N | time
Print the most recent N lines, or lines since time ('MM-DD hh:mm:ss.mmm'), then exit (implies -d).-T N | time
Like -t but keeps following the log.--pid pid
Only print logs from the given process ID.--uid uids
Only print logs from the given comma-separated numeric UIDs.-g, --buffer-size
Print the size of the ring buffers.-G, --buffer-size=size
Set the ring buffer size (suffix K or M).-S, --statistics
Print logging statistics.-p, --prune / -P 'list'
Get or set the prune (allow/deny) rules.--wrap
Sleep for 2 hours or until the buffer is about to wrap.
PRIORITY LEVELS
V: VerboseD: DebugI: InfoW: WarningE: ErrorF: FatalS: Silent (suppress all output)
CAVEATS
Requires an adb connection (or a shell on the device). Buffers are small ring buffers, so older messages are overwritten, and logs are lost on reboot unless read with -L. Apps can only see their own logs; reading other apps' logs requires adb, root, or the READ_LOGS permission. Many logd control options require root.
HISTORY
logcat is part of the Android platform, developed by Google. It has been the primary Android logging tool since Android's release in 2008. The logd daemon replaced the old kernel logger driver in Android 5.0.
SEE ALSO
adb(1), adb-logcat(1), dmesg(1), journalctl(1)
