This project is an enhanced fork of the original pidcat script, revitalized with modern features for a cross-platform world.
Its primary enhancements provide full Windows support and vastly improved user feedback, making Android debugging a seamless experience on any operating system.
- 🖥️ Truly Cross-Platform: Works seamlessly on Windows, macOS, and Linux.
- 🎨 Color-Coded Output: Makes logs scannable by color-coding tags and log levels (Verbose, Debug, Info, Warn, Error).
- 📦 Smart Package Filtering: Automatically find an app's Process ID (PID) and show only relevant logs.
- 🗣️ Verbose Feedback: The script tells you what it's doing! It confirms device connections, finds PIDs, and warns you if a specified app isn't running—no more silent failures.
- 📱 Multiple Device Support: Interactive device selection when multiple devices are connected.
- ⚡ Windows Automation: Includes an interactive
.bat
script to automate your logging session with a double-click. - ⚙️ Powerful Filtering Options: Filter by minimum log level, specific tags, and more.
Interactive Batch Script (Windows) | Colored pidcat Output (Cross-Platform) |
---|---|
Before you begin, ensure you have the following installed and configured:
- Python 3.6+
- Android SDK Platform-Tools: You must have
adb.exe
in your system's PATH. - The
colorama
library: This is essential for colors on Windows. Install it by running:pip install colorama
Run the script from your terminal, providing the package name of the app you want to monitor.
python pidcat.py [OPTIONS] [PACKAGE_NAME]
Argument | Alias | Description |
---|---|---|
package_name |
- | The full package name of the app (e.g., com.example.app ). |
--clear |
-c |
Clears the logcat buffer before starting the session. |
--min-level |
-l |
Sets the minimum log level to display (e.g., W for Warn). |
--tag |
-t |
Filters for specific log tags (can be used multiple times). |
--current |
- | Attaches to the app currently in the foreground. |
For Windows users, this project includes start_logcat.bat
for an incredibly convenient workflow.
- Interactive: Prompts you to enter a package name.
- Smart Default: Suggests a default package if you just press Enter.
- Auto-Clears: Automatically uses the
-c
flag to start a clean logging session.
- (First Time Only) Open
start_logcat.bat
in a text editor and ensure the path topidcat.py
is correct for your system. - Double-click
start_logcat.bat
. - Type a package name and press Enter. Your logcat session will begin instantly!
Monitor a specific app with a clean buffer:
python pidcat.py -c com.yourapp.package
Show only Warnings and Errors from the current foreground app:
python pidcat.py --current -l W
Filter for multiple specific tags:
python pidcat.py -t "AuthService" -t "Database" com.yourapp.package
Original Project README
An update to Jeff Sharkey's excellent logcat color script which only shows log entries for processes from a specific application package.
During application development you often want to only display log messages coming from your app. Unfortunately, because the process ID changes every time you deploy to the phone it becomes a challenge to grep for the right thing.
This script solves that problem by filtering by application package. Supply the target package as the sole argument to the python script and enjoy a more convenient development process.
pidcat com.oprah.bees.android
Here is an example of the output when running for the Google Plus app:
Get the script:
-
OS X: Use Homebrew.
brew install pidcat
If you need to install the latest development version
brew unlink pidcat brew install --HEAD pidcat
-
Arch Linux : Install the package called
pidcat-git
from the AUR. -
Others: Download the
pidcat.py
and place it on your PATH.
Make sure that adb
from the Android SDK is on your PATH. This script will
not work unless this is that case. That means, when you type adb
and press
enter into your terminal something actually happens.
To include adb
and other android tools on your path:
export PATH=$PATH:<path to Android SDK>/platform-tools
export PATH=$PATH:<path to Android SDK>/tools
Include these lines in your .bashrc
or .zshrc
.
Note: <path to Android SDK>
should be absolute and not relative.
pidcat
requires at least version 8.30 of coreutils
. Ubuntu 20.04 LTS already ships
with it, for 18.04 and below, coreutils
can be upgraded from the focal
repo by running
the following:
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse'
sudo apt-get update
sudo apt-get -t focal install coreutils