Revamping Android Logging

Girish Budhwani
2 min readDec 29, 2020

Debug apps without a Mac or a PC.

Logs play a crucial part in diagnosing issues. Without proper logging, developers may have to spend countless hours debugging the root cause. When the codebase becomes huge, logs can also prove to be useful in understanding complex execution flows. Although one can argue to follow execution from one breakpoint to another, the whole process can be time-consuming. But for the most part, logs are an indispensable tool in any developer’s arsenal. More so for an android developer where there can be network failures, device permission denials, SQL errors, background thread issues, telemetry data inaccuracies, and innumerable other concerns. Since logs are so important, I created a library to conveniently check logs right on your phone.

Vlog library display logs in real-time and in a non-intrusive manner so that one can keep interacting with the app. As seen in the below GIF, the Logcat logs are visible after clicking on the Messenger chat like bubble,

Sample Vlog app

The logs can also be searched and filtered,

Vlog filter

Interesting.. but how to integrate Vlog in my App?

The Vlog library is open-sourced and hosted on Github. Follow this documentation to integrate the library into your Android Application.

What about the Release Apk builds?

Good question! Since the library is used for debugging purposes, it would be redundant and memory consuming to have library dependency in the Release Apk file. To resolve this, separate, but empty, implementation has been created (library-no-op) for release builds. The gradle dependencies can be added as show below, (click here for more details)

dependencies {
debugImplementation 'com.github.girish3.Vlog:library:v0.3'
releaseImplementation 'com.github.girish3.Vlog:library-no-op:v0.3'
}

What if I already use Timber?

Well, I don’t blame you! It’s a great logging library from none other than Jake Wharton. The library is extensible therefore we can seamlessly integrate Vlog alongside Timber. Just add a behavior through Tree instance and plant the instance by calling Timber.plant . For more details, follow this sample app.

If you have any other concern, please post it in the comments. Thank you :)

--

--

Girish Budhwani
Girish Budhwani

Written by Girish Budhwani

Work@Khatabook | Coding | Movies | Philosophy | Sports | Travel