Using Log to debug applications


Log is an API for sending log output

Log can help you debug your code or provide the end user information on what is going on.

 

There are three versions of the log routine, they are: Log.v(), Log.i(), and Log.d().

 

Log.v() - Is used for verbose logging

Log.i() - Is used for general information notification

Log.d() - Is used for error checking and debugging typically used during application development

 

Syntax:

     Log.v(String tag, String msg);

     Log.i(String tag, String msg);

     Log.d(String tag, String msg);

 

Parameters:

tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
msg The message you would like logged.

 

Examples:

       String TAG = "SkeletonActivity";

 

       Log.v(TAG, "Hello");
       Log.i(TAG, "Hello");
       Log.d(TAG, "Hello");

 

$ adb.exe logcat *