Logcat is the primary logging system built into Android. It records messages from the operating system, apps, and the kernel, providing developers and power users with a real‑time view of what’s happening on the device. While Android Studio includes a graphical Logcat viewer, many situations call for a quick command‑line approach using the Android Debug Bridge (ADB). This tutorial walks you through every step required to capture, filter, and save Logcat logs on any Android device that supports ADB.
Enabling USB debugging allows ADB to communicate with your device over a USB or network connection.
The only component you need from the Android SDK is the platform-tools package, which contains ADB.
C:\adb on Windows or ~/adb on macOS/Linux.PATH so you can run adb from any terminal.
setx PATH "%PATH%;C:\adb"export PATH="$PATH:$HOME/adb" to ~/.bash_profile or ~/.zshrc.adb version. You should see something like Android Debug Bridge version 1.0.41.You can connect via USB (the most reliable method) or wirelessly. Both are covered below.
adb devices. You should see a list similar to:
List of devices attached
0123456789ABCDEF device
unauthorized, unlock the phone and tap the “Allow USB debugging?” prompt.adb tcpip 5555 to switch the device to listen on port 5555.adb connect DEVICE_IP:5555. Replace DEVICE_IP with the actual IP.
adb connect 192.168.1.42:5555
connected to 192.168.1.42:5555
adb devices. Your device should now appear as device.
Once the device is recognized, you can start pulling logs.
# Show the most recent logs (default buffer)
adb logcat
Press Ctrl+C to stop the stream.
To view logs from a specific app, you need its package name. You can obtain it via:
adb shell pm list packages | grep keyword
Then filter Logcat by that tag:
adb logcat | grep com.example.myapp
Android maintains several log buffers (main, system, radio, events, crash). By default, logcat reads from the main buffer. To select another buffer, use the -b flag:
# Show radio (cellular) logs
adb logcat -b radio
For a comprehensive view, you can combine buffers:
adb logcat -b main -b system -b radio
Logcat categorises messages by priority: V (Verbose), D (Debug), I (Info), W (Warn), E (Error), F (Fatal), S (Silent). To limit output to warnings and errors only:
adb logcat *:W
You can also set per‑tag levels, for example:
adb logcat MyAppTag:D *:S
This shows Debug and higher messages from MyAppTag while silencing everything else.
For later analysis, redirect the output to a file. It’s good practice to include a timestamp in the filename.
# Save logs for 30 seconds, then stop
adb logcat -d > $(date +%Y%m%d_%H%M%S)_logcat.txt
The -d flag tells Logcat to dump the current buffer and exit immediately. If you need a live capture, omit -d and press Ctrl+C when finished.
If you have Android Studio installed, you can import the saved log file for richer inspection:
.txt file you created.This step is optional but can save time when dealing with long logs.
adb devices
sudo if you’re writing to a protected location.adb logcat -G 10M to increase the buffer size (requires root on many devices).Logcat can contain sensitive information such as API keys, personal identifiers, or even full user messages if an app logs them. Treat saved log files as confidential:
adb logcat -p flag to restrict output to your own app’s UID (available on Android 10+).Capturing Logcat logs with ADB is a straightforward yet powerful technique for diagnosing app crashes, performance hiccups, or unexpected system behaviour. By following the steps above you can:
Armed with these skills, you’ll be able to troubleshoot issues more efficiently, whether you’re a developer, a power user, or simply curious about what’s happening under the hood of your Android device.









