Posts

Showing posts from September, 2013

Android logging put to bed.

I've been developing an android application recently, and I have had to scrabble around more than I should have in order to get logging working correctly so here's what I've learned. How to get logging working; The basics. Android has a Log class that you can use to make log entries. You can find that here; https://developer.android.com/reference/android/util/Log.html Here's an example of a log entry made from an Activity #import android.util.Log; class MyActivity{     private static final String TAG = "MyActivity";     @Override     protected void onCreate(Bundle savedInstanceState) {         Log.v(TAG, "savedInstanceState contains " + savedInstanceState.size() + " mappings");         ......     } } The Log.v call makes a 'verbose' log entry. Log levels (in increasing order of 'importance' are;     ERROR, WARN, INFO, DEBUG, VERBOSE These entries are made with Log.e, Log.w, Log.i, Log.d & Log.v.