What are the best practices for logging in Android apps in production mode, keeping in mind the following requirements :
1- Ability to upload logs for debugging 2- Ability to clean up logs or set rollovers
Thanks
What are the best practices for logging in Android apps in production mode, keeping in mind the following requirements :
1- Ability to upload logs for debugging 2- Ability to clean up logs or set rollovers
Thanks
Our preference is to automatically upload only exceptions. For client logging we prefer to selectively set a flag or have a special debug version that we give to clients with problems.
Exception catching can be done with Thread. setDefaultUncaughtExceptionHandler(). There are some caveats with this (mainly you need to exit() the app after done with exception handling). See: http://groups.google.com/group/android-developers/browse_thread/thread/c32e8c6120bed5c5/54c28b745c0fca80
For log collection see android-log-collector. No need to use the whole package, see the source and copy-paste.
If you'd like to get the crash reports ACRA can be a good solution.ACRA is a library enabling Android Application to automatically post their crash reports to a GoogleDoc form.