Android: Better Logging Output

Ever got annoyed by the flood of information in Android's adb logcat output? Luckily Google Engineer Jeff Sharkey put together a Python script to make the output visually more appealing and easier to follow. Below are a few tipps on how to effectively combine coloredlogcat.py with adb logcat's parameters and options.

Colored Logcat Output
Setup
  1. Download coloredlogcat.py from Jeff Sharky's blog
  2. Copy the script to your local ~/bin folder and make it executable
  3. mkdir ~/bin cp ~/Downloads/coloredl chmod +x ~/bin/coloredlogcat.py
  4. Add ~/bin permanently to your $PATH variable. Either in your .bashrc or .zshrc (or whatever shell you use) add or modify this line:
  5. export PATH=$HOME/bin:$PATH
Usage
You can either use it directly, by simply entering coloredlogcat.py, or you can use adb logcat with all it's parameters and just pipe it into coloredlogcat.py

Show only DEBUG output from the MyApp TAG. Everything else is SILENT: *:s (not shown)
adb -d logcat "*:S MyApp:D" | coloredlogcat.py
Show only WARNING, ERROR and FATAL output. Great for checking on exceptions.
adb -d logcat "*:W" | coloredlogcat.py
References
Logcat priorities
  • V — Verbose (lowest priority)
  • D — Debug
  • I — Info
  • W — Warning
  • E — Error
  • F — Fatal
  • S — Silent (highest priority, on which nothing is ever printed)
Special options
  • adb logcat -c clears the entire log



I've just launched a new side project of mine:

Bugfender - A modern remote logger tailor-made for mobile development

It's currently free and you can sign up here: https://app.bugfender.com/signup

Any kind of feedback is more than appreciated :-)

1 comment:

  1. Thanks for posting. Is there windows compatible version of this script? I found it uses fcntl module (not available in Windows distribution).

    Thanks.

    Regards,
    Dragan

    ReplyDelete