What are the different Logging options available in Android?

By | May 29, 2017

Android uses a centralized logging system.

However you can write your own custom log statements.

Log Statements

To write log statements, you use use the android.util.Log class with the following methods:

  • Log.v()
  • Log.d()
  • Log.i()
  • Log.w()
  • Log.e()
  • Log.wtf()

They are sorted by relevance with Log.i() being the least important one. The first parameter of these methods is a TAG string and the second is the message

However passing a NULL string could crash the application. so beware.

Turn Off Logs in Production

You can create your own constant for distinguishing Production and Development environments.


Simply you could do like this

if (BuildConfig.DEBUG) {
    Log.e(Constants.TAG, "My Message");

Please leave your valuable comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *