How to Debug an Android Application using LogCat – Part I

In this blog post, i’ll teach you on how to Debug an Android Application using LogCat. This blog helps newbie mostly on debugging an app before and after App publishing. So lets get Started.

What is LogCat? 

LogCat is a command used for looking into the Logs generated from various programs running on Android application environment. This logcat can be used from ADB shell to view the logs. The Android Logging provides a mechanism for collecting and viewing system debug output. Every android log message has a tag and Priority associated with it.

  • Tag:  string indicating from which component the message originates.
  • Priority: is one of the character values ordered from lowest to highest priority. LogCat has different levels of logging.
  • V-Verbose(lowest priority)
  • D-Debug
  • I-Info
  • W-Warning
  • E-Error
  • F-Fatal
  • S-Silent

The developers can also write custom log messages.

To write log statements, you use the android.util.Log class with the Log.v(), Log.d(), Log.i(), Log.w(), Log.e(), this is somewhat similar to Java applications, done by printing messages in the console window using System.out.println(String message) method.

The first parameter of these methods is the TAG and the second is the Message to Log. Basic Example of Logging custom log message.

import android.os.Bundle;
import android.util.Log;
public class helloWorld extends Activity {
     /** Called when the activity is first created. */
private static final String TAG="";
     public void onCreate(Bundle savedInstanceState) {
         Log.d(TAG,"I'm Debugging Android Application");


How to open LogCat window?
In Eclipse you can view the LogCat window by selecting Window -> Show View -> Other and choosing LogCat from the Android category.



LogCat displaying logs:


You can also filter Logs based on their Tag, pid or Log Level (Error, Warning, Info, Debug, Verbose) or you can define your own custom filter.



Now read my next blog on how to Debug an Android Application before and after publishing.

Hope this helpful. Your valuable comments are always welcomed. It will help to improve my post and understanding.

durga chiranjeevi

durga chiranjeevi

I'm currently working as Android developer at Energy Alternatives India. Interested in Application and Game development.
durga chiranjeevi

Leave a Reply

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