Logging in Android Studio

  • Replies:2
  • OpenNot stickiedUnanswered
  • Forum posts: 5

Nov 17, 2018, 1:50:01 PM via Website


How can I use the logging facility in Android Studio for debug purpose? I tried using the Log.d() feature but nothing seems to log. Thanks

  • Forum posts: 4

Dec 7, 2018, 10:58:49 AM via Website

Hello Sures,
By using Log.d() you write the output to the Logcat file which you can open at the bottom of Android Studio.
To make a better job, you should set, at the beginning of every class you want to log, a TAG constant containing the name of the class itself, then log into the Logcat in this way: Log.v(TAG, "text to be logged"). This way you will be able to filter the logs.
The different Logcat methods are:
Log.v(); // Verbose
Log.d(); // Debug
Log.i(); // Info
Log.w(); // Warning
Log.e(); // Error

Have a nice day.


Recommended articles