Reading and Writing Logs
The Android logging system provides a mechanism for collecting and viewing system debug output. Logcat dumps a log of system messages, which include things such as stack traces when the emulator throws an error and messages that you have written from your application by using theLog
class.
The Log
class
Log
is a logging class that you can utilize in your code to print out messages to the LogCat. Common logging methods include:v(String, String)
(verbose)d(String, String)
(debug)i(String, String)
(information)w(String, String)
(warning)e(String, String)
(error)
Log.i("MyActivity", "MyClass.getView() — get item number " + position);
The LogCat will then output something like:
I/MyActivity( 1557): MyClass.getView() — get item number 1
Using LogCat
Filtering Log Output
Every Android log message has a tag and a priority associated with it.
- The tag of a log message is a short string indicating the system component from which the message originates (for example, "View" for the view system).
- The priority is one of the following character values, ordered from lowest to highest priority:
V
— Verbose (lowest priority)D
— DebugI
— InfoW
— WarningE
— ErrorF
— FatalS
— Silent (highest priority, on which nothing is ever printed)
Export Logs
Log Collector - an app that can send the log on the device to your email,facebook, ...
Kyoro Logcat - an app that can send mail but more importantly can show you logs in REAL TIME !!
The following app was published using this post.
source - http://developer.android.com/tools/debugging/debugging-log.html
Nathan
No comments:
Post a Comment