Wednesday, November 30, 2011

Android LogCat filter in Eclipse

Very often during development we need to filter messages in LogCat View. Logcat Message Filter Settings already allow you to filter logs by Log Tag, Log Message, by PID, by Application Name and by Log Level. But sometimes it is not enough.

Fortunately log filter accepts Java regular expressions.
For example, to match only two tags we can use the following expression in Log Tag field:


Sometimes you need to exclude some messages from Logcat. In old ADT versions it could be done with creating new logcat filter when filtered messages were deleted from main log.
In ADT 15.0.1 such functionality was changed and filtered messages stay in main log.

And also Java regular expressions can help to get rid of annoying messages:
To exclude tag  “dalvikvm” from log:  (?!dalvikvm\b)\b\w+

DDMS LogCat still has some issues in spite of regular updates of ADT and SDK Tools. One of the most known is about small log buffer that requires to press “clear log” button periodically.

This issue and many others are solved in open source tool android-log-viewer developed by Mikhail Lopatkin:

  • Display logs from a device or an emulator
  • Display saved logs and dumpstate files
  • Search in the logs using regex if needed
  • Bookmarks
  • Filter log lines by tag, PID, log priority, message content
  • Filtered lines can be hidden, highlighted or shown in a separate window
  • Display any avaliable buffers: main, system, events, radio
  • Save filtered lines
  • Display process list


  1. Hi I'm trying to filter the dalvikvm-heap messages using the same method but I can't get it to work. Any ideas?