private static final String ACTIVITY_TAG="MainActivity";
Log.v(MainActivity.ACTIVITY_TAG, "This is Verbose");
Log.d(MainActivity.ACTIVITY_TAG, "This is Debug.");
Log.i(MainActivity.ACTIVITY_TAG, "This is Information");
Log.w(MainActivity.ACTIVITY_TAG, "This is Warnning.");
Log.e(MainActivity.ACTIVITY_TAG, "This is Error.");
Eclipse logcat中查看指定Tag
tag:MainActivity
另外也可以在java层
System.out.println("tag by System out");
tag:System.out
查看某个变量,需要将变量转换为String类型
int k = 563;
Log.v(MainActivity.ACTIVITY_TAG, "This is Verbose k=" + k);