Fixed formatting.

This commit is contained in:
hns 2002-10-14 15:24:18 +00:00
parent 43b9e08027
commit d1fe0ad7c8

View file

@ -288,15 +288,15 @@ public final class Logger {
} }
private static void rotateAllLogs () { private static void rotateAllLogs () {
int nloggers = loggers.size(); int nloggers = loggers.size();
for (int i=nloggers-1; i>=0; i--) { for (int i=nloggers-1; i>=0; i--) {
Logger log = (Logger) loggers.get (i); Logger log = (Logger) loggers.get (i);
try { try {
log.rotateLogFile (); log.rotateLogFile ();
} catch (IOException io) { } catch (IOException io) {
System.err.println ("Error rotating log " + log.getCanonicalName() + ": " + io.toString ()); System.err.println ("Error rotating log " + log.getCanonicalName() + ": " + io.toString ());
} }
} }
} }
/** /**
@ -307,10 +307,10 @@ public final class Logger {
public void run () { public void run () {
long nextMidnight = nextMidnight (); long nextMidnight = nextMidnight ();
while (runner == this && !isInterrupted ()) { while (runner == this && !isInterrupted ()) {
if (nextMidnight < System.currentTimeMillis ()) { if (nextMidnight < System.currentTimeMillis ()) {
rotateAllLogs (); rotateAllLogs ();
nextMidnight = nextMidnight (); nextMidnight = nextMidnight ();
} }
int nloggers = loggers.size(); int nloggers = loggers.size();
for (int i=nloggers-1; i>=0; i--) { for (int i=nloggers-1; i>=0; i--) {
try { try {
@ -364,18 +364,18 @@ public final class Logger {
public static long nextMidnight () { public static long nextMidnight () {
Calendar cal = Calendar.getInstance (); Calendar cal = Calendar.getInstance ();
cal.set (Calendar.DATE, 1 + cal.get(Calendar.DATE)); cal.set (Calendar.DATE, 1 + cal.get(Calendar.DATE));
cal.set (Calendar.HOUR_OF_DAY, 0); cal.set (Calendar.HOUR_OF_DAY, 0);
cal.set (Calendar.MINUTE, 0); cal.set (Calendar.MINUTE, 0);
cal.set (Calendar.SECOND, 1); cal.set (Calendar.SECOND, 1);
// for testing, rotate the logs every minute: // for testing, rotate the logs every minute:
// cal.set (Calendar.MINUTE, 1 + cal.get(Calendar.MINUTE)); // cal.set (Calendar.MINUTE, 1 + cal.get(Calendar.MINUTE));
return cal.getTime().getTime (); return cal.getTime().getTime ();
} }
public static long lastMidnight () { public static long lastMidnight () {
return nextMidnight () - 86400000; return nextMidnight () - 86400000;
} }
/** /**