read the logger.config when its been updated, even if we dont have any log messages to write out (duh)

also, a micro-optimization for charset handling identified through profiling
This commit is contained in:
jrandom
2004-06-19 23:02:59 +00:00
committed by zzz
parent deff14dfd8
commit 57d24bd948

View File

@ -47,6 +47,7 @@ class LogWriter implements Runnable {
rotateFile(); rotateFile();
while (_write) { while (_write) {
flushRecords(); flushRecords();
rereadConfig();
} }
} }
@ -70,6 +71,9 @@ class LogWriter implements Runnable {
} finally { } finally {
try { Thread.sleep(100); } catch (InterruptedException ie) {} try { Thread.sleep(100); } catch (InterruptedException ie) {}
} }
}
private void rereadConfig() {
long now = Clock.getInstance().now(); long now = Clock.getInstance().now();
if (now - _lastReadConfig > CONFIG_READ_ITERVAL) { if (now - _lastReadConfig > CONFIG_READ_ITERVAL) {
_manager.rereadConfig(); _manager.rereadConfig();
@ -94,7 +98,9 @@ class LogWriter implements Runnable {
if (val == null) return; if (val == null) return;
if (_currentOut == null) rotateFile(); if (_currentOut == null) rotateFile();
byte b[] = val.getBytes(); byte b[] = new byte[val.length()];
for (int i = 0; i < b.length; i++)
b[i] = (byte)(val.charAt(i) & 0xFF);
try { try {
_currentOut.write(b); _currentOut.write(b);
_numBytesInCurrentFile += b.length; _numBytesInCurrentFile += b.length;