diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-01-27 21:48:55 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-01-27 22:06:00 +0800 |
| commit | 68161d044d2206de8193e67014bb86aae60551b8 (patch) | |
| tree | 7e6d8df7ebf56504c3053aa641ca05c8eb56e84e /runtime/src/main/java/me | |
| parent | 7e6321f649111cdeb0b391ef3203864247bd7b9d (diff) | |
| download | RoughlyEnoughItems-68161d044d2206de8193e67014bb86aae60551b8.tar.gz RoughlyEnoughItems-68161d044d2206de8193e67014bb86aae60551b8.tar.bz2 RoughlyEnoughItems-68161d044d2206de8193e67014bb86aae60551b8.zip | |
Fix #719
Diffstat (limited to 'runtime/src/main/java/me')
| -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 |
