How to filter a tag in an Eclipse LogCat viewer

I have an Android application that spam LogCat, and I would like to delete its logcat entries to make the output more readable.

Is it possible to have a filter that removes LogCat entries for a specific tag name? Or a search pattern that does the trick?

+72
android eclipse logcat
Oct 25 '11 at 13:20
source share
7 answers

Yes. Create a filter in which the "By log tags" field

^(?!.*(MYTAG)).*$ 

where MYTAG is the tag you do not want to see. I'm not a regex expert ("regexpert"? ;-)), so there may be an easier way to do this negation, but I just tried it and it works.

You can play with the filter in the field just above the Cat log message area by entering filter lines there, for example:

 tag:^(?!.*(DeskClock|dalvik|wpa)).*$ 

which displays all messages except for the tags "DeskClock", "dalvik" and "wpa".

+178
Nov 15 '11 at 17:36
source share

This may not seem to be directly related to the issue, but there is a regular expression that filters out most of the system logs when you put it in your filter tag as described by Rob .

 ^(?!(WifiMulticast|WifiHW|MtpService|PushClient|InputMethodManager|Provider|SurfaceTextureClient|ImageLoader|dalvikvm|OpenGLRenderer|skia|AbsListView|MediaPlayer|AudioManager|VelocityTracker|Drv|Jpeg|CdpDrv|IspDrv|TpipeDrv|iio|ImgScaler|IMG_MMU|ResMgrDrv|JpgDecComp|JpgDecPipe|mHalJpgDec|PipeMgrDrv|mHalJpgParser|jdwp|libEGL|Zygote|Trace|InputEventReceiver|SpannableStringBuilder|IInputConnectionWrapper|MotionRecognitionManager|Choreographer|v_galz|SensorManager|Sensors|GC|LockPatternUtils|SignalStrength|STATUSBAR-BatteryController|BatteryService|STATUSBAR-PhoneStatusBar|WifiP2pStateTracker|Watchdog|AlarmManager|BatteryStatsImpl|STATUSBAR-Clock)) 

I keep updating this list of tags as I am facing testing them on different devices. The list is not exhaustive, and you can contribute to this answer. I am sure that this will save an hour for many.

If there are other other logs you need to filter them out, add them to this regular expression using '| ' character.

+9
Nov 06 '13 at 5:56
source share

Depends on how you view your logarithm.

If you use the logcat GUI, it’s best to create a filter for the tags you want to see. They fall into a separate category. Although ui has changed a bit, you can use this old answer from me . It should be clear how this is used (make sure that the “Saved Filters Tab” button is pressed, otherwise you will not see the “Add Filter” button. You can find this in the upper right corner of the log). I do not know a single parameter that allows you to filter specific tags from the entire log.

If you use the command line, you can disable certain tags. Example:

 adb logcat AndroidRuntime:S *:V 

shows everything ( *:V ) to the verbose log level, except for the AndroidRuntime tag, which will be limited to the word "silence", which means that it will not print anything.

To display a single tag, you can use

 adb logcat *:S MyAppTag:V OtherTag:V 

The same thing, everything turns off except MyAppTag and OtherTag. For more information, see Filtering Log Output .

+8
Oct 25 '11 at 13:27
source share

I could not choose a suitable solution for working in Android Studio (IDE, which will be supplied with future versions of the SDK for Android). However, the following regex solved my problem:

 ^(?!dalvikvm) 
+5
Apr 07 '14 at 20:19
source share

I have a trick:

  Log.d(TAG, "MyTag" + message); 

As you can see, when filtering with the "MyTag" key, it shows only the log from my tag.

+3
Oct 25 2018-11-11T00:
source share

This is a late answer, but perhaps useful. In the Eclipse environment, the LogCat view has a search box above the table. Notice when it is empty, it reads:

Search for messages. Accepts Java regular expressions. Prefix with pid :, app :, tag: or text: to limit the scope.

This means that you can filter your tag by writing the tag: MyTag or even the regex : My tag there . *

+1
Apr 15 2018-12-15T00:
source share

Another way to filter out log messages that do not come from your application is to choose:

Log Level: Detailed

Show only selected application (from the drop-down list of filters)

Then select your application from the dropdown list in the logcat window.

This should only show log messages and output from your application.

0
Jun 07 '15 at 1:17
source share



All Articles