fix: makeNewLogFile() in FileLoggerUtilities appending to the file instead of deleting the existing one

This commit is contained in:
Chayapak 2024-11-10 08:31:43 +07:00
parent 3811790c93
commit 4f8d5bfff5
Signed by: ChomeNS
SSH key fingerprint: SHA256:0YoxhdyXsgbc0nfeB2N6FYE60mxMU7DS4uCUMaw2mvA

View file

@ -79,7 +79,7 @@ public class FileLoggerUtilities {
public static synchronized void makeNewLogFile() throws IOException { public static synchronized void makeNewLogFile() throws IOException {
currentLogDate = LocalDate.now(); 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.write(currentLogDate.toString() + '\n');
logWriter.flush(); logWriter.flush();
} }