From 3472ea06c1c2694e941c78af0984f073e85d3f45 Mon Sep 17 00:00:00 2001 From: hns Date: Wed, 6 Nov 2002 11:13:18 +0000 Subject: [PATCH] Only rotate log files if the existing file is not empty. --- src/helma/util/Logger.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/helma/util/Logger.java b/src/helma/util/Logger.java index ff724a6a..ec482c24 100644 --- a/src/helma/util/Logger.java +++ b/src/helma/util/Logger.java @@ -202,13 +202,14 @@ public final class Logger { * start a new one. */ private void rotateLogFile () throws IOException { - // if the logger is not file based do nothing + // if the logger is not file based do nothing. if (logfile == null) return; if (writer != null) try { writer.close(); } catch (Exception ignore) {} - if (logfile.exists()) { + // only backup/rotate if the log file is not empty, + if (logfile.exists() && logfile.length() > 0) { String today = aformat.format(new Date()); int ct=0; File archive = null;