工程下载地址:http://download.csdn.net/detail/flying_vip_521/4366008
转载请注明出处
package com.innofidei;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class LocatUtil {
private static String logToFileCommand = "logcat -v time -f ";
public static void startLog(String saveiDir, String fileName) {
SimpleDateFormat format = new SimpleDateFormat("yyMMdd_HHmmss");
String nowStr = format.format(new Date());
fileName = fileName + "_" + nowStr + ".txt";
new File(saveiDir).mkdirs();
try {
Runtime.getRuntime().exec(logToFileCommand + saveiDir + fileName);
} catch (IOException e) {
e.printStackTrace();
}
}
}