From 059bfaf1d9f93eb2c461a3c04bf8220adc2cd956 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Sat, 12 Nov 2022 16:44:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=97=A5=E5=BF=97=E6=94=B6?= =?UTF-8?q?=E9=9B=86=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/shayu/phonelive/utils/LogUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/shayu/phonelive/utils/LogUtils.java b/app/src/main/java/com/shayu/phonelive/utils/LogUtils.java index 6138f8967..37cbf1015 100644 --- a/app/src/main/java/com/shayu/phonelive/utils/LogUtils.java +++ b/app/src/main/java/com/shayu/phonelive/utils/LogUtils.java @@ -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");