List of utility methods to do Log File Write
void | WriteLogToSDCard(Context context, String tag, String logFileName, String msg) Write Log To SD Card if (DEBUG_DEVELOPER_MODE) { Log.i(tag, msg); if (WRITE_LOG_SDCARD_SWITCH && android.os.Environment.getExternalStorageState().equals( android.os.Environment.MEDIA_MOUNTED)) { try { File dirPath = context.getExternalCacheDir(); ... |
void | writeLog(File logFile, String tag, String message, Throwable tr) write Log logFile.getParentFile().mkdirs(); if (!logFile.exists()) { try { logFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); String time = timeFormat.format(Calendar.getInstance().getTime()); synchronized (logFile) { FileWriter fileWriter = null; BufferedWriter bufdWriter = null; PrintWriter printWriter = null; try { fileWriter = new FileWriter(logFile, true); bufdWriter = new BufferedWriter(fileWriter); printWriter = new PrintWriter(fileWriter); bufdWriter.append(time).append(" ").append("E").append('/') .append(tag).append(" ").append(message) .append('\n'); bufdWriter.flush(); tr.printStackTrace(printWriter); printWriter.flush(); fileWriter.flush(); } catch (IOException e) { closeQuietly(fileWriter); closeQuietly(bufdWriter); closeQuietly(printWriter); |