fix the reread short circuiting algorithm

This commit is contained in:
jrandom
2004-05-20 10:44:31 +00:00
committed by zzz
parent e7e8ad9bdc
commit 242b9a6af9

View File

@ -197,8 +197,10 @@ public class LogManager {
private void loadConfig() { private void loadConfig() {
File cfgFile = new File(_location); File cfgFile = new File(_location);
if ((_configLastRead > 0) && (_configLastRead >= cfgFile.lastModified())) { if ((_configLastRead > 0) && (_configLastRead >= cfgFile.lastModified())) {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.INFO))
_log.debug("Short circuiting config read"); _log.info("Short circuiting config read (last read: "
+ (_context.clock().now() - _configLastRead) + "ms ago, config file modified "
+ (_context.clock().now() - cfgFile.lastModified()) + "ms ago");
return; return;
} else { } else {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
@ -209,7 +211,7 @@ public class LogManager {
try { try {
fis = new FileInputStream(cfgFile); fis = new FileInputStream(cfgFile);
p.load(fis); p.load(fis);
_configLastRead = cfgFile.lastModified(); _configLastRead = _context.clock().now();
} catch (IOException ioe) { } catch (IOException ioe) {
System.err.println("Error loading logger config from " + new File(_location).getAbsolutePath()); System.err.println("Error loading logger config from " + new File(_location).getAbsolutePath());
} finally { } finally {