5
A
回答
6
日誌收集器的源代碼在Google Code上可用。他們實際上只是調用logcat。在這裏看到:android-log-collector - SendLogActivity.java
這裏是關鍵部分:
ArrayList<String> commandLine = new ArrayList<String>();
commandLine.add("logcat");//$NON-NLS-1$
commandLine.add("-d");//$NON-NLS-1$
ArrayList<String> arguments = ((params != null) && (params.length > 0)) ? params[0] : null;
if (null != arguments){
commandLine.addAll(arguments);
}
Process process = Runtime.getRuntime().exec(commandLine.toArray(new String[0]));
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = bufferedReader.readLine()) != null){
log.append(line);
log.append(App.LINE_SEPARATOR);
}
0
你可以使用內置的錯誤報告系統。 http://blog.tomtasche.at/2012/10/use-built-in-feedback-mechanism-on.html
ApplicationErrorReport report = new ApplicationErrorReport();
report.packageName = report.processName = getApplication()
.getPackageName();
report.time = System.currentTimeMillis();
report.type = ApplicationErrorReport.TYPE_CRASH;
report.systemApp = false;
ApplicationErrorReport.CrashInfo crash = new ApplicationErrorReport.CrashInfo();
crash.exceptionClassName = e.getClass().getSimpleName();
crash.exceptionMessage = e.getMessage();
StringWriter writer = new StringWriter();
PrintWriter printer = new PrintWriter(writer);
e.printStackTrace(printer);
crash.stackTrace = writer.toString();
StackTraceElement stack = e.getStackTrace()[0];
crash.throwClassName = stack.getClassName();
crash.throwFileName = stack.getFileName();
crash.throwLineNumber = stack.getLineNumber();
crash.throwMethodName = stack.getMethodName();
report.crashInfo = crash;
Intent intent = new Intent(Intent.ACTION_APP_ERROR);
intent.putExtra(Intent.EXTRA_BUG_REPORT, report);
startActivity(intent);
+0
[這是關於Meta上這些帖子的討論](http ://meta.stackexchange.com/q/153352/152134) – 2012-11-01 21:48:31
相關問題
- 1. Android系統日誌文件
- 2. 如何從系統日誌/系統日誌獲取數據
- 3. 如何在Redhat中獲取系統日誌文件
- 4. 如何獲取系統日誌形式4.3 android操作系統
- 5. Android文件系統日誌記錄
- 6. 閱讀Android 4.1上的系統日誌
- 7. Python系統日誌文件
- 8. 使用PHP讀取系統日誌
- 9. 如何讀取系統日誌中的安卓果凍豆
- 10. 系統日誌:在日誌文件中錯誤PROGRAMNAME(#001)
- 11. 如何使用系統日誌獲取perl stderr到httpd日誌文件
- 12. android系統和日誌
- 13. FastMM4,如何讀取日誌文件?
- 14. 在java中讀取日誌文件
- 15. Android:只讀文件系統
- 16. 無法讀取android系統日食的項目文件
- 17. 如何讀取日誌從日誌文件,因爲它發生
- 18. 如何在C++中讀取這個日誌文本文件
- 19. R如何導入日誌文件系統json文件?
- 20. 無法讀取遠程系統事件日誌
- 21. 如何從Java程序獲取Android系統日誌
- 22. 在日誌解析器中讀取IIS日誌文件
- 23. 如何發送系統日誌通過TCP在系統日誌服務器
- 24. 追蹤日誌文件系統
- 25. Ubuntu:大系統日誌和kern.log文件
- 26. 讀取Android文件系統中的所有文件
- 27. 獲取系統日誌在果凍豆
- 28. 如何在Junit測試中讀取日誌文件
- 29. 如何在Perl中讀取持續更新的日誌文件?
- 30. 如何在Cloud9中讀取Heroku日誌?
EboMike的鏈接後,導致404,在這裏它感動:http://code.google.com/p/android-log-collector/source/browse/trunk/在我的博客點擊此處瞭解詳情src/com/xtralogic/android/logcollector/SendLogActivity.java?r = 2 – Inoy 2012-10-11 09:25:30
(答案中的鏈接已更新,我也將關鍵部分複製到答案中) – EboMike 2013-11-12 00:24:07