JeffLemon
JeffLemon

Reputation: 273

Android - Trace

How can I trace the output from eclipse and the android simulator. I am used to doing it in Flash and actionscript.

In AS3 it would be: trace('my trace statement');

Upvotes: 1

Views: 1263

Answers (2)

meddlingwithfire
meddlingwithfire

Reputation: 1437

You have a few options. One is the java.util.logging.ConsoleHandler class: http://developer.android.com/reference/java/util/logging/ConsoleHandler.html

ConsoleHandler console = new ConsoleHandler();
console.publish(new LogRecord(Level.INFO, "Hello logging!"));

Another option is using the Log class: http://developer.android.com/reference/android/util/Log.html

Log.v("MyIdentifier", "Hello logging!");

Upvotes: 2

Kurru
Kurru

Reputation: 14331

In android use the Log class to provide this. Simply pick a level you want "debug, warning, info" and then use the function. ie `Log.d("tag","message");

Then this message will appear in the LogCat Eclipse window

Upvotes: 0

Related Questions