Only rotate log files if the existing file is not empty.

This commit is contained in:
hns 2002-11-06 11:13:18 +00:00
parent 2b5057e136
commit 3472ea06c1

View file

@ -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;