diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-01-27 21:48:55 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-01-27 21:48:55 +0800 |
| commit | 3ca59503b1f18d46c729d9605d3c2159795aea9d (patch) | |
| tree | 1a0278a1b598dd6d744b874f91c49489302d4d42 /runtime/src/main/java | |
| parent | ac2c8ad0d6e27682b8a05dabd9f7a08f7c25e096 (diff) | |
| download | RoughlyEnoughItems-3ca59503b1f18d46c729d9605d3c2159795aea9d.tar.gz RoughlyEnoughItems-3ca59503b1f18d46c729d9605d3c2159795aea9d.tar.bz2 RoughlyEnoughItems-3ca59503b1f18d46c729d9605d3c2159795aea9d.zip | |
Fix #719
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 |
