logcat output can be difficult to read at times. If you are working with a device that has a large amount of logcat output, it can be frustrating to search for the few, relevant lines. The default color scheme for logcat output in Android Studio only uses a couple of colors so most of the log looks exactly alike! We can apply a new color scheme to help customize logcat. Doing this makes it significantly easier to find the output you might be looking for. It’s also a lot nicer to look at, in general.
Back in the days before Android Studio, we used Eclipse with ADT (Android Developer Tools). ADT included the DDMS (Dalvik Debug Monitor Server), and the logcat output the DDMS provided out of the box was styled much better than the default Android Studio styling. Until recently, DDMS was even available within Android Studio, but it was deprecated in 3.1 and removed from 3.2. The DDMS logcat styling was colorful and much easier on the eyes than the default Android Studio color schemes.
Thankfully, Android Studio at least empowers us to fix this problem ourselves. We can configure the logcat output colors.
I’ve been asked about my logcat scheme a lot recently. It seems that most people don’t know that we can customize the output. Or maybe they do know, and they find it a tedious exercise. Configuring this aspect of the scheme could definitely be easier. There are a number of hoops to jump through, but none of them are difficult. It can be frustrating, but, no worries, I’m going to walk you through it.
Walkthrough to Customize Logcat
In your preferences, either search for “logcat” or manually go to Editor > Color Scheme > Android Logcat. You’ll need to duplicate one of the main schemes (if you haven’t already) so that you can modify it. You can do that from the little cogwheel/gear icon and selecting “Duplicate…” Type a name for your custom scheme and press enter to save it. Now you can modify the colors, but you’ll have to uncheck the “Inherit values from:” box in order to do so. Once you’ve done these simple steps, you’ll be clear to make changes and customize your environment.
If you don’t have logcat enabled you can find that in
Preferences | Build, Execution, Deployment | Debugger
You can easily change the color of each log level and configure the background color, effect (underscore, strikethrough, etc.) just like you configure any other aspect of code display styles.
So spend a little time playing with the configuration and make your life easier. If you’ve never experienced the joy of a less monotone logcat, you’ll wonder how you ever got by on a daily basis.
If you prefer, you can download a theme from my github. I created one based on Darcula as well as Default. These configure nothing except the logcat output so you can easily see if you like these colors.
Here are the color values I used for the themes as shown in the walkthrough:
* ASSERT: bb2b2f
* DEBUG: 1194d6
* ERROR: db332f
* INFO: 0c890d
* VERBOSE: a8a8a8
* WARNING: bb7000
You may want to manually adjust your scheme, or just change one or two items.
If you didn’t already know you could customize logcat in Android Studio, this will get you 90% of the way to custom scheme. Think about other ways you might customize Android Studio in the future.