Reprinted from: http://developer.51cto.com/art/201001/180265.htm
Since the Android mobile phone operating system is one of the most attractive advantages, it is an open-source operating system, and its writing method is simple and flexible, it can easily help users achieve various needs. Here, we will first try to experience the features of log output from Android.
The log class of Android. util can be used to output logs in Android.
For example, after executing the following code, the log is output to the logcat view.
Log. V ("tag", "message ");
Choose WINDOW> show View> logcat in eclipse.
Android output log routine source code (Java)
- Package com. test;
- Import Android. App. activity;
- Import Android. OS. Bundle;
- Import Android. util. log;
- Public class testactivity extends activity {
- /** Called when the activity is first created .*/
- @ Override
- Public void oncreate (bundle savedinstancestate ){
- Super. oncreate (savedinstancestate );
- Setcontentview (R. layout. Main); // log processing
- Log. V ("tag", "message ");
- }
- }
Android output log-related applications are introduced here.