diff --git a/src/org/redkale/boot/LogFileHandler.java b/src/org/redkale/boot/LogFileHandler.java index 194cc0f32..085582ea7 100644 --- a/src/org/redkale/boot/LogFileHandler.java +++ b/src/org/redkale/boot/LogFileHandler.java @@ -154,6 +154,8 @@ public class LogFileHandler extends Handler { if (greater.exists()) Files.move(greater.toPath(), new File(logfile.getPath() + "." + (i + 1)).toPath(), REPLACE_EXISTING, ATOMIC_MOVE); } Files.move(logfile.toPath(), new File(logfile.getPath() + ".1").toPath(), REPLACE_EXISTING, ATOMIC_MOVE); + } else { + if (logfile.exists() && logfile.length() < 1) logfile.delete(); } logstream = null; } @@ -166,6 +168,8 @@ public class LogFileHandler extends Handler { if (greater.exists()) Files.move(greater.toPath(), new File(logunusualfile.getPath() + "." + (i + 1)).toPath(), REPLACE_EXISTING, ATOMIC_MOVE); } Files.move(logunusualfile.toPath(), new File(logunusualfile.getPath() + ".1").toPath(), REPLACE_EXISTING, ATOMIC_MOVE); + } else { + if (logunusualfile.exists() && logunusualfile.length() < 1) logunusualfile.delete(); } logunusualstream = null; }