sqlite 데이터베이스에 logcat 항목을 저장할 수 있습니까? 사용자가 오류가 발생하는 경우 전화기를 adb에 연결하지 않고 로그를 읽으려고합니다. SQLite 데이터베이스에 LogCat 항목 저장
이
내가 로그를 작성하는 방법입니다 : 오류를public void mlogFile(String pActivityName, String pOperation, String pData) {
File lLogFilePath, lLogFile;
Date lDate;
CharSequence lCurrfolder;
FileWriter lFileWriter;
BufferedWriter lBuffWriter;
String lActivity, lOperation;
try {
lDate = new Date();
lCurrfolder = DateFormat.format("yyyyMMdd", lDate.getTime());
lLogFilePath = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "CSPDCLData/" + lCurrfolder + "/");
if (!lLogFilePath.exists()) {
lLogFilePath.mkdirs();
}
lLogFile = new File(lLogFilePath, "ADDLogfile.txt");
lFileWriter = new FileWriter(lLogFile, true);
lBuffWriter = new BufferedWriter(lFileWriter);
lActivity = pActivityName.length() != 0 ? ADDPadding(pActivityName, 25, ' ', 'L') + "~ " : "";
lOperation = pOperation.length() != 0 ? " : " + pData : "";
lBuffWriter.append(DateFormat.format("kk:mm:ss", lDate.getTime()) + " " + lActivity + pOperation + lOperation + "\n");
lBuffWriter.flush();
lBuffWriter.close();
lFileWriter.close();
} catch (IOException ex) {
Toast.makeText(this, "ERROR: " + ex.getMessage(), Toast.LENGTH_SHORT).show();
}
}
을 읽고 더 나은 선택이 될 것입니다 로그 파일을 생성 Log.d(TAG, "An error occured", e)
감사
왜 [오류보고 라이브러리] (https://fabric.io/kits/and)를 사용하지 않습니까? roid/crashlytics/summary) (게시하는 경우)? 관련 충돌 로그가있는 응용 프로그램이 손상되었을 때 메일을 보냅니다. –
응용 프로그램을 중단하지 않고도 오류가 발생할 수 있습니다. –
instabug https://instabug.com/을 사용할 수 있습니다. 크래시의 전체 내용을 제공합니다 –