LinuxCommandLibrary

logcat

displays Android system and application logs

TLDR

View all logs

$ adb logcat
copy
Filter by tag
$ adb logcat -s [TAG]
copy
Filter by priority
$ adb logcat "*:[E]"
copy
Clear log buffer
$ adb logcat -c
copy
Output to file
$ adb logcat > [logfile.txt]
copy
Show specific buffer
$ adb logcat -b [main,system,crash]
copy
Format output
$ adb logcat -v [time]
copy

SYNOPSIS

logcat [options] [filter...]

DESCRIPTION

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.

PARAMETERS

-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.

PRIORITY LEVELS

V: Verbose
D: Debug
I: Info
W: Warning
E: Error
F: Fatal

CAVEATS

Requires adb connection. Buffer size limited. Old logs cleared on reboot. Some logs need root access.

HISTORY

logcat is part of the Android SDK, developed by Google. It has been the primary Android logging tool since Android's release in 2008, evolving to support more buffers and filtering options.

SEE ALSO

adb(1), dmesg(1), journalctl(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard