Android : Is this below code is correct for saving logcat details to a file in eclipse?

on Friday, December 5, 2014


public static void saveLogcatToFile(Context context) {

String fileName = "logcat_"+System.currentTimeMillis()+".txt";



File outputFile = new File(context.getExternalCacheDir(),fileName);

@SuppressWarnings("unused")

Process process = Runtime.getRuntime().exec("logcat -f "+outputFile.getAbsolutePath()); }


Please check the above code and help me to save the logcat details to file (permanently), it should append after everytime debugging in eclpise.


0 comments:

Post a Comment