开发者

Android Logging & Report Generation

In Android applications, what is the best strategy to generate reports that can be viewed later by user? I'm talking about normal running of the application, not necessarily errors & exceptions.

I've a few options in mind but each one seems to have issues:

  1. Logcat (use a specific tag “MyAppsLog”, provide user a functionality to read all statements logged using that tag)

    Note: I believe the primary purpose of Logcat is for providing debugging info for the developer, not for the end user.

  2. Manually open a flat file and append your logging statements to it.

    Note: Can go this route if there is no standard mechanism for logging and report generation. Since this is such a standard requirement, I'm hoping not to re-invent the wheel. Also, if the application is re-installed the file can get lost. If written in sdcard/external storage to avoid this possibility, might not be private.

  3. Use a third party tool like ACRA or android-remote-stacktrace

    Note: I think the purpose of these too开发者_开发技巧ls is crash-reporting, I don't think they are the best bet for standard report generation.

Many enterprise applications need to have a way to generate reports (normal running of app, not error), that the enterprise-user can view later. I'm hoping the answers here would be useful to more people than just me.


Well how about using an SQLite database, and dumping the log data in a table? Beats the flat file option I think. You can even aggregate dumped data or start queries on it.


Sqlite is heavy and taking lots of memory and process.

Advantages of flat file:

  1. single point of all log info,
  2. easy to manage,
  3. easy to delete (clear cache)
  4. performance (when file size grow up) performance of apps remain same
  5. Anyone can read log file and can know which process is running on
  6. if data is not big/complex, not that much important (if any one read it) then use flat file only.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜