diff options
Diffstat (limited to 'runtime/src/main/java')
| -rw-r--r-- | runtime/src/main/java/me/shedaniel/rei/impl/common/logging/FileLogger.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/FileLogger.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/FileLogger.java index abd192ba6..d773113d7 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/FileLogger.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/FileLogger.java @@ -23,6 +23,7 @@ package me.shedaniel.rei.impl.common.logging; +import org.apache.commons.io.output.NullOutputStream; import org.apache.logging.log4j.Level; import java.io.*; @@ -37,13 +38,17 @@ public class FileLogger implements Logger { private final Writer writer; public FileLogger(Path file) { + Writer w; try { if (file.getParent() != null) Files.createDirectories(file.getParent()); file.toFile().createNewFile(); - this.writer = new OutputStreamWriter(new FileOutputStream(file.toFile()), StandardCharsets.UTF_8); + w = new OutputStreamWriter(new FileOutputStream(file.toFile()), StandardCharsets.UTF_8); } catch (IOException exception) { - throw new UncheckedIOException(exception); + exception.printStackTrace(); + w = new OutputStreamWriter(new NullOutputStream()); } + + this.writer = w; } @Override |
