e.printStackTrace到底在哪能看到的?该如何处理
e.printStackTrace到底在哪能看到的?
public class logManager {
private static final String TAG = "logManager";
private static final int LOG_FILE_MAX_SIZE = 1 * 1024;
public static File getLogFile() {
String dir = android.os.Environment.getExternalStorageDirectory() + "/Log/";
String filepath = null;
try {
File file = new File(dir);
long size = 0;
if (!file.exists()) {
file.mkdir();
}
filepath = dir + "log01.txt";
file = new File(filepath);
if (!file.exists()) {
file.createNewFile();
return file;
}
else {
size = file.length();
if(size >= LOG_FILE_MAX_SIZE) {
filepath = dir + "log02.txt";
file = new File(filepath);
if (!file.exists()) {
file.createNewFile();
return file;
}
else {
size = file.length();
if(size >= LOG_FILE_MAX_SIZE) {
filepath = dir + "log01.txt";
file = new File(filepath);
if(file.exists()) {
file.delete();
}
file.createNewFile();
return file;
}
else {
return file;
}
}