In the clip above, you can see that the LogCat view defaults in with the Problems, Console, and other views in the bottom-right. I like it there. The second column in the view shows the logging level; this level comes from the method called on the Log object. Here are the clips from my code that correspond to the 'I' messages.
Log.i("ListBuckets", "Setting up grid.");
GridView g = (GridView) findViewById(R.id.bucket_list);
g.setAdapter(new ImageAdapter(this, mBucketsDb.fetchAllBuckets()));
Above, I used just a plain string for the 'tag'; this seems like the common approach in the Android sample code. Below, I went to my more normal use of using the class as the tag.
public void onCreate(SQLiteDatabase db) {
Log.i(BucketsDbAdapter.class.toString(), "Creating fresh database.");
db.execSQL(DATABASE_CREATE);
To add the LogCat view to the Java perspective:
1. open the workspace that houses your projects
2. Window -> Show View -> Other...
3. expand the Android tree node and select LogCat
3 comments:
Just what I was looking for, thanks!
Adrian Vintu posted a comment but I accidentally deleted it. Here is the contents from the comment. Very cool stuff:
Here is a tool to enhance your logcat experience
Windows link http://adrianvintu.com/blogengine/post/Colored-Logcat-Script-for-Windows.aspx
Linux link http://jsharkey.org/blog/2009/04/22/modifying-the-android-logcat-stream-for-full-color-debugging/
BR,
Adrian Vintu
Very useful info about adding LogCat to your Java perspective. Thanks
Post a Comment