How to output messages to the Eclipse console when developing for Android


How can I print messages (like a flag) to the Eclipse console (or log) when developing and debugging an Android app

4/22/2014 4:03:41 PM

Accepted Answer

Rather than trying to output to the console, Log will output to LogCat which you can find in Eclipse by going to: Window->Show View->Other…->Android->LogCat

Have a look at the reference for Log.

The benefits of using LogCat are that you can print different colours depending on your log type, e.g.: Log.d prints blue, Log.e prints orange. Also you can filter by log tag, log message, process id and/or by application name. This is really useful when you just want to see your app's logs and keep the other system stuff separate.

5/9/2012 11:18:03 AM

Log.v("blah", "blah blah");

You need to add the android Log view in eclipse to see them. There are also other methods depending on the severity of the message (error, verbose, warning, etc..).

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow