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 37cbf1015..6aa7404d1 100644 --- a/app/src/main/java/com/shayu/phonelive/utils/LogUtils.java +++ b/app/src/main/java/com/shayu/phonelive/utils/LogUtils.java @@ -42,8 +42,8 @@ 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(".log") && !"error.log".equals(file.getName())) { - String fileName = file.getName().replace(title, ""); + if (file.getName().endsWith(".log") && !"error.log".equals(file.getName())) { + String fileName = file.getName().replace(title, "").replace(".log", ""); 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,true); + FileOutputStream os = new FileOutputStream(saveFile, true); writer = new PrintWriter(os); while ((line = bufferedReader.readLine()) != null) { writer.append(line).write("\n");