From e20619e0c945159eabcf42b9e72d7eb933a18420 Mon Sep 17 00:00:00 2001 From: Redkale <22250530@qq.com> Date: Fri, 5 Jan 2018 08:42:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=A0=E9=99=A40=E5=AD=97?= =?UTF-8?q?=E8=8A=82=E7=9A=84=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/org/redkale/boot/LogFileHandler.java | 4 ++++ 1 file changed, 4 insertions(+) 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; }