Android - Use logcat instead of System.out.print

In android it is recommended to use Logcat instead of System.out.print for debugging and testing issues.

Logcat uses android.util.Log 
Log.d(String tag, String message)

The above method is used to perform logging in android for debugging purposes.


Here we have used this to log on each callback method in android activity

Log.d("LIFECYCLE", "onCreate was called");

Similarly for

  • Information logging: Log.i()
  • Error logging: Log.e()
  • Warning logging: Log.w()
  • Verbose logging: Log.v()

Actually here is no difference except color and decoration of different types of logging



Comments