Correct `WritingLogFile` to append to files rather than overwrite them.
This also updates `initFileArg` so that the debug logging directory is cleared on every compiler invocation. This is important so that log data doesn't get combined between runs.
@@ -23,6 +23,7 @@ import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.StandardOpenOption;
import java.util.function.Supplier;
/**
@@ -38,7 +39,12 @@ final class WritingLogFile extends LogFile {
try {
Path dir = file.getParent();
Files.createDirectories(dir);
- return new WritingLogFile(Files.newBufferedWriter(file));
+ return new WritingLogFile(
+ Files.newBufferedWriter(
+ file,
+ StandardOpenOption.CREATE,
+ StandardOpenOption.APPEND,
+ StandardOpenOption.WRITE));
} catch (IOException e) {
throw new RuntimeException(e);
}
