I’ve stumbled across a lot of logs noise in Android Studio throughout the time and it can be a pain when you need to debug a crash or just read some important logs of your app when your device/emulator prints lots of logs. Those logs are helpful for some cases but might not be for yours.
There is a simple way to filter Android Studio logs by ignoring the ones you don’t need and that can be easily done and you can see how in the following lines.
Steps to filter logs in Android Studio
- Open your project with Android Studio
- Open the Logcat window/tab
- Go to “Show only selected application” filter drop down (should be on the right of the logcat window)
- Select “Edit Filter Configuration” item from the drop down
- In the “Create New Logcat Filter” window you can add a new filter depending on your needs in the respective sections (“Log Tag”, “Log Message” or “Package Name”)
Below you can see the steps in images (because for most of us those are 1000 times better than words 🙂 ).
Based on what you need you can add Regex for tags, messages or package names (that compose a log output in logcat). Make sure you also select the appropriate/desired “Log level” and then press ok and select your newly created log filter. The output should be much cleaner now.
Below you can see a simple sample of regex for 3 tags and that one will filter out any of those encountered tags from the logcat output in Android Studio that starts with any of the enumerated tags. The ‘!’ mark does the trick(makes those tags disappear from your logs list) but you can play with it and see what better fits your needs. Also, you can see that I’ve added 3 example tags separated by “|”, you can leave as many as you need or leave just one.
If there are other ways to do this please write them in the article comments section so others can see them and better filter their logs in Android Studio.