调整日志收集的参数
This commit is contained in:
parent
9f0b6897f1
commit
059bfaf1d9
@ -31,7 +31,7 @@ public class LogUtils {
|
||||
String[] exec = new String[]{"logcat", "-c"};
|
||||
Runtime.getRuntime().exec(exec).waitFor();
|
||||
|
||||
exec = new String[]{"logcat", "-v", "color", "-D"};
|
||||
exec = new String[]{"logcat", "-v", "UTC", "-D"};
|
||||
|
||||
Process process = Runtime.getRuntime().exec(exec);
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
@ -42,7 +42,7 @@ public class LogUtils {
|
||||
File dir = new File(context.getDir("files", Context.MODE_PRIVATE).getAbsolutePath() + File.separator);
|
||||
if (dir.listFiles() != null) {
|
||||
for (File file : dir.listFiles()) {
|
||||
if (!file.getName().endsWith(today + ".log") && !"error.log".equals(file.getName())) {
|
||||
if (!file.getName().endsWith(".log") && !"error.log".equals(file.getName())) {
|
||||
String fileName = file.getName().replace(title, "");
|
||||
if (isDelLog(fileName)) {
|
||||
file.delete();
|
||||
@ -51,7 +51,7 @@ public class LogUtils {
|
||||
}
|
||||
}
|
||||
File saveFile = new File(context.getDir("files", Context.MODE_PRIVATE).getAbsolutePath() + File.separator + today + ".log");
|
||||
FileOutputStream os = new FileOutputStream(saveFile);
|
||||
FileOutputStream os = new FileOutputStream(saveFile,true);
|
||||
writer = new PrintWriter(os);
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
writer.append(line).write("\n");
|
||||
|
Loading…
Reference in New Issue
Block a user