Capture Logcat Logs on Android Using ADB

10 min read Learn how to capture, filter, and save Logcat logs from your Android device using ADB. This step‑by‑step guide covers setup, commands, and troubleshooting. September 26, 2026 04:00 How to Capture Logcat Logs on Android Using ADB – Step‑by‑Step Guide

Introduction

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.

What You’ll Need

  • A Windows, macOS, or Linux computer with internet access.
  • An Android phone or tablet running Android 5.0 (Lollipop) or newer.
  • A USB cable (or a reliable Wi‑Fi connection for wireless ADB).
  • Basic familiarity with a command‑line terminal.

Step 1 – Enable Developer Options and USB Debugging

  1. Open Settings on your Android device.
  2. Scroll down to About phone (or About tablet).
  3. Tap Build number seven times. You’ll see a toast notification that says “You are now a developer!”.
  4. Return to the main Settings screen. A new entry called Developer options should appear.
  5. Enter Developer options and toggle USB debugging on. Confirm any security prompts.

Enabling USB debugging allows ADB to communicate with your device over a USB or network connection.

Step 2 – Install the Android SDK Platform‑Tools

The only component you need from the Android SDK is the platform-tools package, which contains ADB.

  1. Download the package for your OS from the official Android developer site: platform‑tools download.
  2. Extract the ZIP archive to a convenient location, e.g., C:\adb on Windows or ~/adb on macOS/Linux.
  3. Add the extracted folder to your system PATH so you can run adb from any terminal.
    • Windows: setx PATH "%PATH%;C:\adb"
    • macOS/Linux: add export PATH="$PATH:$HOME/adb" to ~/.bash_profile or ~/.zshrc.
  4. Open a new terminal window and verify the installation with adb version. You should see something like Android Debug Bridge version 1.0.41.

Step 3 – Connect Your Device to ADB

You can connect via USB (the most reliable method) or wirelessly. Both are covered below.

USB Connection

  1. Connect the device to your computer with a USB cable.
  2. In the terminal, run adb devices. You should see a list similar to:
    List of devices attached
    0123456789ABCDEF    device
  3. If you see unauthorized, unlock the phone and tap the “Allow USB debugging?” prompt.

Wireless (TCP/IP) Connection

  1. First, connect the device via USB as described above.
  2. Run adb tcpip 5555 to switch the device to listen on port 5555.
  3. Find the device’s IP address (Settings → About phone → Status → IP address).
  4. Disconnect the USB cable.
  5. Run 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
  6. Verify with adb devices. Your device should now appear as device.

Step 4 – Basic Logcat Commands

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

Step 5 – Using Logcat Buffers

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

Step 6 – Filtering by Log Level

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.

Step 7 – Saving Logs to a File

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.

Step 8 – Analyzing Logs with Android Studio (Optional)

If you have Android Studio installed, you can import the saved log file for richer inspection:

  1. Open Android Studio and go to View → Tool Windows → Logcat.
  2. Click the “Open Logcat file” icon (folder) and select the .txt file you created.
  3. Use the built‑in filters, search, and stack‑trace parsing to locate issues quickly.

This step is optional but can save time when dealing with long logs.

Step 9 – Common Issues and How to Fix Them

  • Device not listed in adb devices
    • Make sure USB debugging is enabled.
    • Try a different USB cable or port.
    • On Windows, install the appropriate OEM USB driver (e.g., Google USB Driver for Pixel devices).
  • Permission denied when writing a file
    • Ensure you have write permission to the directory you’re saving the log in.
    • On macOS/Linux, you may need to prepend sudo if you’re writing to a protected location.
  • Logcat shows only a few lines
    • Some devices limit the size of the in‑memory buffer. Use adb logcat -G 10M to increase the buffer size (requires root on many devices).

Step 10 – Security and Privacy Considerations

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:

  • Never share raw logs publicly without redacting personal data.
  • If you’re debugging a third‑party app, consider using the adb logcat -p flag to restrict output to your own app’s UID (available on Android 10+).

Conclusion

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:

  • Set up ADB on any desktop OS.
  • Connect your Android device via USB or Wi‑Fi.
  • Run targeted Logcat commands, filter by tag or level, and export logs for deeper analysis.

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.

User Comments (0)

Add Comment
We'll never share your email with anyone else.