How to use Log.isLoggable

Copied in some code that had code such as:

if (Log.isLoggable(TAG, Log.DEBUG)) {
  Log.d(TAG, "onConnected: " + connectionHint);
}

and I couldn’t find any logs in logcat. If I remove the if statement then log commands appear. Solution was to enter a command (eg in Terminal in Android Studio) such as

adb shell setprop log.tag.<tagname> DEBUG

 

This entry was posted in Android. Bookmark the permalink.

Leave a Reply

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