Android 4 trick: Cutting through LogCat noise.

The new r14 ADT that came out with Android 4 has a greatly improved LogCat view in Eclipse. The new view lets you filter using regular expressions, and it also sets up a temporary session filter when you run a program that shows only the messages from your program's process. And it works for all versions of Android, not just Android 4.

Suppose you want to see messages from all processes but you don't want to see the annoying and repetitive ones. To do that, go to the LogCat view and display the Saved Filters pane if it's not already open. Then select the "Add" button (it looks like a plus sign). The Logcat Message Filter Settings dialog will open. Enter the following information exactly as shown with no spaces:

Filter Name: NotJunk
by Log Tag: ^(?!Wifi|HierarchicalStateMachine).*$

then click OK. Now as long as you have your new filter selected in the Saved Filters pane, the LogCat output will be stripped of messages that have a tag starting with "Wifi" or "HierarchicalStateMachine". I picked those because my Galaxy Tab likes to spew them out several times a second. I'm sure you have your own least favorites. To make another tag be excluded, click the "Edit" icon and add the tag to your regular expression. For example, this pattern also excludes all messages from "BatteryService":

by Log Tag: ^(?!BatteryService|Wifi|HierarchicalStateMachine).*$

Separate all the tags you want to exclude with the pipe symbol ("|"). Keep re-editing the filter to take out more and more noise. So far I haven't found an upper limit on the size. I've been adding to mine all day and here's what I have so far:

by Log Tag: ^(?!installd|PackageManager|GTalkService|WpsStateMachine|jdwp|AndroidRuntime|LockPatternUtils|MTPR|BooksSync|MyEbooksFetcher|MusicSyncAdapter|SurfaceFlinger|Sensors|SensorManager|power|InputDispatcher|BookmarksSync|SyncManager|Quickoffice|ActivityThread|AttachmentService|MediaExtractor|DrmManager|TabletStatusBar|nvos_linux|NuHTTPDataSource|MediaPlayer|FactoryTestPhone|AndroidMusic|DSM|AESCrypto|OrientationDebug|TimedEventQueue|ActivityManager|GpsLocationProvider|GoogleMeeting|DFTRil|DftRil|NvOmx|gcomm|MediaUploader|GooglePlus|MPL-ml|libmpu|AudioPlayer|AudioFlinger|MusicDL|MusicStore|KeepOnScheduler|NetworkMonitor|MusicContent|AsyncCursor|AudioPolicyManager|DBG_WSS|OMX|NuCached|HTTPStream|AwesomePlayer|alsa|AudioHardware|ApplicationStartDetector|DrmManagerClient|MMT|szipinf|ANDROID_DRM|PlayreadyPlugIn|Flx|wpa|vending|UpdateService|Venezia|TelephonyManager|System\.out|Plume|web|ProvisionLog|TLINE|libEGL|OpenGLRenderer|FotaClient|CursorWrapperInner|jykim|WindowManager|PerformBackupThread|Background Updates|SessionStore|skia|dalvikvm|ProcessImageRunnable|Gmail|EventLogService|DownloadExecutor|switchboard|Environment|Image proc|News Processor|NewsGrabber|Wifi|HierarchicalState|BatteryService|.*Keyguard|LockScreen|Tweet[cC]aster|.*ManagerService|NetdConnector).*$

You have to be careful not to get too carried away with this or you run the risk of missing something important (like the ones you're printing in your own code). If that happens just go back to the "All messages (no filters)" filter, or start a new filter with a smaller list of tags.

Once you filter out all the noise, LogCat can become useful again! You'd be surprised what kind of debugging messages people leave in their code.
Shared publiclyView activity