From 4f8d5bfff5d9fae01ed1946ceaf1988058c1f307 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 10 Nov 2024 08:31:43 +0700 Subject: [PATCH] fix: makeNewLogFile() in FileLoggerUtilities appending to the file instead of deleting the existing one --- .../java/me/chayapak1/chomens_bot/util/FileLoggerUtilities.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/chayapak1/chomens_bot/util/FileLoggerUtilities.java b/src/main/java/me/chayapak1/chomens_bot/util/FileLoggerUtilities.java index c67f329..eccbf66 100644 --- a/src/main/java/me/chayapak1/chomens_bot/util/FileLoggerUtilities.java +++ b/src/main/java/me/chayapak1/chomens_bot/util/FileLoggerUtilities.java @@ -79,7 +79,7 @@ public class FileLoggerUtilities { public static synchronized void makeNewLogFile() throws IOException { currentLogDate = LocalDate.now(); - logWriter = new OutputStreamWriter(Files.newOutputStream(logPath, StandardOpenOption.CREATE, StandardOpenOption.APPEND), StandardCharsets.UTF_8); + logWriter = new OutputStreamWriter(Files.newOutputStream(logPath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING), StandardCharsets.UTF_8); logWriter.write(currentLogDate.toString() + '\n'); logWriter.flush(); }