Logging in Android Studio

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

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

Hi,

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

Reply
  • Forum posts: 1,124

Nov 17, 2018, 3:39:28 PM via Website

To display the LogCat in Android Studio, from the Main menu select View>Tool Buttons to display the tool buttons at the bottom-left of the screen. Click on 6: Android to display the LogCat.

A minimalist app on Google Play - https://goo.gl/ws42fN
Ad-Free & Full-Free. Download size < 0.07 MB.
Blog - https://okblackcafe.blogspot.com

Helpful?
Reply
  • 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.
Mauro

Helpful?
Reply