Logging in Android Studio

  • Replies:2
Suresh Kumar
  • 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
James Watson
  • Forum posts: 1,584

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.

Download size < 0.15 MB. But also accurate enough, ad-free & free.
The minimalist app available on Play Store: https://goo.gl/ws42fN
Blog: https://okblackcafe.blogspot.com Your 5-star is appreciated.

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