How to exclude Log Tag in logcat Android Studio?
Asked Answered
C

3

68

I'm not sure if this kind of question been asked before (I did Google it but not found the proper way to solve my question).

what I hope is I can disable (exclude) Log Tag from libraries used in my project.

I tried to go in Logcat console > Edit Filter Configuration > Log Tag(regex) but here I have to add new Log Tag every time I create it. (and this way will not show any exception in my logcat)

Same as this topic How to filter logcat in Android Studio? I selected select the process running as @dmsherazi suggest but I still can see lots of log tag from libraries.

So, is there a way to exclude specific log tag in android studio (I'm using v1.2 beta3)?

Czarevitch answered 14/4, 2015 at 4:49 Comment(2)
Related post - How to exclude certain messages by TAG name using Android adb logcat?Swelling
Does this answer your question? How to exclude certain messages by TAG name using Android adb logcat?Photoplay
C
176

I'm sorry for answering my own question after 20 minutes of asking. My friend just sent me a link that solves my question

here it is: How to exclude certain messages by TAG name using Android adb logcat?

for android studio users

go to Logcat console > Edit Filter Configuration > Log Tag(regex) and put this instead

^(?!(EXCLUDE_TAG1|EXCLUDE_TAG2))

note that EXCLUDE_TAG1 and EXCLUDE_TAG2 are Log Tag you exclude from logcat.


Another way to answer the question is to exclude all, except ... To block all tags from showing up, except INCLUDE_TAG

(?:INCLUDE_TAG) for one tag
(?:(INCLUDE_TAG1|INCLUDE_TAGx)) for multiple tags
Czarevitch answered 14/4, 2015 at 5:10 Comment(7)
How do you find this? I'm at the logcat tab of Android Monitor, but I don't see "Edit Filter Configuration" anywhere. I'm running Android Studio 2.2.3Gannie
Never mind, I found it ... it's one of the options on the dropdown on the far right. The dropdown may show "No Filters", "Show only selected application", etc. Poor UI design that one of these options pops up a settings dialog!Gannie
This seems to disable "Show only selected application", which floods the log with way too many things. I had to manually add my.package.name to "Package Name" without Regex.Protrude
@Protrude Add your package name in Package Name: of the Edit Filter Configuration .Gambeson
Any regex for both include and exclude tagCroft
I found it's possible to add as many exclusions as you like just by keeping on adding |EXCLUSION_TAGx behind the last one.Cosmorama
@Killer it doesn't make sense to have include and exclude in one regex, so I updated the answer with the "exclude all, except" approach.Cosmorama
W
16

With the new Android Studio Logcat, you can do it using the following filter:

-tag:tag_to_exclude

This is per the documentation:

Negation is expressed by prepending a - to the field name. For example, -tag:MyTag matches log entries whose tag doesn't contain the string MyTag.

Woe answered 27/3, 2023 at 14:26 Comment(0)
L
0

For example if you want to exclude "native", enter ^(?!(native|FEngine)) in "Log Tag: " and check Regex

enter image description here

Lamentation answered 11/12, 2022 at 5:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.