Here you can find the source of logError(Object errorClass, String msg, Exception e)
public static void logError(Object errorClass, String msg, Exception e)
//package com.java2s; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.PrintWriter; import java.io.StringWriter; import android.util.Log; public class Main { public static File logFile; public static boolean writeLogFile; public static void logError(Object errorClass, String msg, Exception e) { logError(errorClass.getClass().toString(), msg, e); }//from www .j av a 2s.c o m public static void logError(String errorClass, String msg, Exception e) { Log.e(errorClass, msg, e); if (writeLogFile && logFile != null) { String completeError = "\n" + "\n" + errorClass + " // " + msg + " // " + e.getMessage() + "\n"; StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); completeError += errors.toString() + "\n"; writeLog(completeError); } } public static void writeLog(String msg) { try { // if file doesnt exists, then create it if (!logFile.exists()) { logFile.createNewFile(); } FileWriter fw = new FileWriter(logFile.getAbsoluteFile(), true); BufferedWriter bw = new BufferedWriter(fw); bw.write(msg); bw.close(); } catch (Exception e) { } } }