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()

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 *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.