My Life with Android
Introduction Android Componets UserInterface Advanced UI Data Storage Advanced Concepts Others New Studio

Android Log

  • In java, you can do System.out.println() to dump a message where you want to, but it does not work in Android.
  • There is an Android Log class that lets you create log messages with one line of code.
    Log.d("Tag Name", "Log Message").
  • Tag Name is a tag that you provide with a message that lets you filter the log messages.
  • Log Message is outputs messages.
You can view the messages in LogCat window in Eclipse. It is located at the bottom of Eclipse.


Opening LogCat in Eclipse:
Simply follow the steps below to get the window


Message Filtering in LogCat

You should provide a tag for your log messages as it will make it easy for you to search for the message using the tag.

For eg:
Log.d("MyTag","This is sample log message")
You can search for the message by putting tag:MyTag in the search field of LogCat.


You can filter/search messages through application name also.
EX : app:org.codelearn.twitterapp

Create Message Filter

Click on the green '+' button next to 'Saved Filters' as shown below to create a new filter.


Do not add prefix tag:,app:
Clicking on the filter name will apply filter to log messages.

Saving & Clearing logs