Monday, February 09, 2009
Minimal code to perform logging in Google Android
At the top of the file in the imports section add:
And then in your code you add
It is considered good form that the TAG is a constant for the class.
So I put something like this at the top of the class
private static final String TAG = Foo.class.getName();
There are several levels of logging and in level order these are
Log.v(), Log.d(), Log.i(), Log.w()and
v = verbose
d = debug
i = info
w = warning
e = error
The logging is performed by LogCat which can be accessed via the adb tool that comes with the Android developer kit.
tools/adb logcatwill start logging at the
INFOlevel as that is the default.
tools/adb logcat *:Vwill log everything at
tools/adb logcat Wibble:Wwill filter most things and only show those log statements with the tag
Labels: google android
Links to this post:
Subscribe to Posts [Atom]