如何将日志信息从Android应用发送到服务器?

问题描述:

我正在开发当前在Play商店中使用的Android应用。我一直在收到关于某些无法重现的设备崩溃的报告,并且Play商店的内置崩溃诊断信息不足。我真正需要的是来自这些设备的Logcat信息,但是似乎Android 4.1及更高版本不允许出于安全考虑使用那些以前非常流行的 Log Collector应用。是否可以将库添加到我的应用程序中,以使其按需登录到远程服务器?我对这次崩溃了解得足够多,如果我有这样的函数,可以在代码的适当位置调用一些神话般的sendLogcatNow()函数。由于我寻求的信息实际上并不是崩溃的一部分(崩溃以后会发生),因此常规的崩溃报告工具(例如Crashlytics)似乎无法满足我的需要,但也许它们具有此功能,并且在其中并不突出文档。谢谢!

I'm developing an Android app that is currently in the Play Store. I've been getting reports of a crash on certain devices that I can't reproduce, and the Play Store's built in crash diagnostics don't contain enough information. What I really need is the Logcat information from these devices, but it seems that Android 4.1 and above don't allow the use of those "Log Collector" apps that used to be so popular for this purpose due to security concerns. Is there a library that I can add to my app that will allow it to log to a remote server on demand? I know enough about this crash that I could put a call to some mythical sendLogcatNow() function in the appropriate spot in the code, if I had such a function. Since the information I seek is not actually part of the crash (the crash occurs later), normal crash reporting tools such as Crashlytics don't seem like they will do what I need, but perhaps they have this feature and it's just not prominent in the documentation. Thanks!

崩溃报告的版本很少。.

There are few version for crash reporting..


  1. 曲棍球应用程序

  2. Acra

  3. BugSense

  4. Android远程堆栈跟踪

  5. 由于您的应用程序始终可以自行读取日志,因此您也可以实现自己的操作。

  1. Hockey App
  2. Acra
  3. BugSense
  4. Android Remote stack trace
  5. Since your app can always read logs for it's own process, you can also implement something of your own.

在所有这些中,我个人更喜欢 Acra 。因为它效率最高,并为应用程序开发人员提供了许多选择。

Out of all these, I personally prefer Acra. as it is most efficient and give many options to app developers.