The way to get faster in development.

In this post, I will be sharing logcat tips from my development environment.

ihsan BAL
3 min readFeb 11, 2018
Two split windows from development environment

I am using some common libraries for networking like most android developer. For example Retrofit, OkHttp3, RxJava2. First of all I won’t get into detail on these libraries. I am just going to show you what I do to make my development process easier. At this point we can move on step-by-step instructions of setting up the an environment for logging request and response data of an application. Here we go!

As you can see from second image above I am using Pidcat as an external logcat. Pidcat is a colored logcat script which only shows log entries for a specific application package. Let's first start with installing Pidcat step-by-step.

1- Install Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2- Install Pidcat:
brew install pidcat
3- Make sure that adb from the Android SDK is on your path:
adb version if you can't see ADB version please follow step 4 and 5.
4- Create or edit bash_profile file:
touch ~/.bash_profile; open ~/.bash_profile
5- Paste this two line at bottom of the text editor and save the changes:
export ANDROID_HOME=$HOME/<installation lication>/sdk
export PATH=${PATH}:ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
6- Ready to fire:
pidcat com.ihsanbal.logging
Bonus: You can filter your log by tag
pidcat com.ihsanbal.logging -t LoggingI

Now It's time to beauty logcat with LoggingInterceptor. LoggingInterceptor is An OkHttp interceptor that makes reading logs requests and responses human friendly. Take a look the sample code below.

Final view after using Pidcat and LoggingInterceptor together.

Logcat filtered with LoggingI tag

Also Android Studio now supports inspecting network traffic with network profiler if you are using HttpUrlConnection or OkHttp. These days, I am trying to get used to network profiler but I am still in love with Pidcat and LoggintInterceptor. It's kinda cool when you use Pidcat full screen with extra monitor but this doesn't mean things not going to change.

--

--