Published in


Logging in Android

I am sure that each developer out there have heard the phrase ‘Check the logs’ at least once during his or here career! And checking the logs have saved my ass several times this month. But what exactly a log message is and what are the advantages and disadvantages of logging? Let’s try to find out!

What is logging?

Logging — the cutting, skidding, on-site processing and loading of trees onto trucks. (taken from Wikipedia) OK just kidding… but what about logging in software development? This is the process of printing or saving information about what exactly your code is doing and what is the current data it works with.

Most, if not all, programming languages support the idea of logging in one way or another. Although, the syntax is probably different, the general idea is always the same.

Pros & Cons of Logging

If used properly, logging can be a life-saving mechanism for discovering bugs, performance issues and other problems. It can also provide valuable information about the usage of your software.

But if done poorly, it can make your life miserable… We all know that feeling of going through thousands and thousands of lines of log messages without any useful info at all.


  • A cheap way of building a stacktrace or a mechanism for monitoring the order of methods execution
  • A way to follow different logic flows throughout your source code
  • A way for monitoring the actual data your code works with

Cons (if done poorly):

  • Can generate tons of useless info
  • Can significantly decrease the readability of your source code

Logging options in Android

The Android framework has it own set of logging options. There is a special Log class which provides the needed functionality for printing a log message. There are also several different types of log messages, which can be used in different situations:

  • Log.e — used for logging messages of type ERROR. This type is usually used inside of catch statements. It notifies us that something bad happened.
  • Log.w — used for logging messages of type WARN (warning). A common use-case for this type is when something strange happened, but it is not necessarily an error.
  • Log.i — used for logging messages of type INFO. It’s perfect when we want to log some useful info like connecting to a server, successfully finishing a process, successfully receiving info from another universe, etc.
  • Log.d — for these cases when you need to be sure that a + b = c or when you want to check if that problematic if statement is actually working. Thus, d stands for DEBUG. Some of you may think that, if this log message is used for debugging, then ALL Log.d messages will be stripped automatically during runtime. And if you refer to the official Android documentation, you will be right! But… in reality that’s not the case. You will have to make some additional steps in order to achieve that.
  • Log.v — V for Vendetta… nope… ‘v’ stands for VERBOSE. This is more like a general type of a log message. You should use it whenever you want to print some very detailed info about the event that occurred.
  • — I know what you are thinking, but ‘wtf’ stands for ‘What a Terrible Failure’. It looks like Log.e, but it’s way more sever. It’s to be used in these strange cases, which should never happen but… they do from time to time…


Check out my personal blog for more articles regarding Android!

If you liked this, click the💚 below so other people will see this here on Medium.




The (retired) Pub(lication) for Android & Tech, focused on Development

Recommended from Medium

GraphQL QuickStart with Spring Boot, Kotlin and MongoDB

Inside the Unity Editor

Steps to setup Kafka cluster on Local And Docker

How to make scroll image animation like Sony, Apple and Samsung

Using test suites in Go

C Mini — Project 1: Grids

Flutter iap subscription config

Amazon Elastic Compute Cloud(EC2)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Todor Kostov

Todor Kostov

Android developer @Scaleforce

More from Medium

Kotlin Android For Beginners

Jetpack DataStore in Modern Android Development

5 Key Differences Between iOS and Android App Development Services

How I reduced my App Size: Android App Bundles