android.util.Log
Generally, use the Log.v() Log.d() Log.i() Log.w() and Log.e() methods.
The order in terms of verbosity, from least to most is ERROR, WARN, INFO, DEBUG, VERBOSE. Verbose should never be compiled into an application except during development. Debug logs are compiled in but stripped at runtime. Error, warning and info logs are always kept.
Tip: A good convention is to declare a TAG constant in your class:
private static final String TAG = "MyActivity"; and use that in subsequent calls to the log methods.
Tip: Don't forget that when you make a call like
Log.v(TAG, "index=" + i); that when you're building the string to pass into Log.d, the compiler uses a StringBuilder and at least three allocations occur: the StringBuilder itself, the buffer, and the String object. Realistically, there is also another buffer allocation and copy, and even more pressure on the gc. That means that if your log message is filtered out, you might be doing significant work and incurring significant overhead.
Summary
Constants
int
Priority constant for the println method.
int
Priority constant for the println method; use Log.d.
int
Priority constant for the println method; use Log.e.
int
Priority constant for the println method; use Log.i.
int
Priority constant for the println method; use Log.v.
int
Priority constant for the println method; use Log.w.