From 57d24bd9482ff351a88197dac57bb2d3293649c4 Mon Sep 17 00:00:00 2001 From: jrandom Date: Sat, 19 Jun 2004 23:02:59 +0000 Subject: [PATCH] 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 --- core/java/src/net/i2p/util/LogWriter.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/java/src/net/i2p/util/LogWriter.java b/core/java/src/net/i2p/util/LogWriter.java index 716b01b2f..4f6ba20cd 100644 --- a/core/java/src/net/i2p/util/LogWriter.java +++ b/core/java/src/net/i2p/util/LogWriter.java @@ -47,6 +47,7 @@ class LogWriter implements Runnable { rotateFile(); while (_write) { flushRecords(); + rereadConfig(); } } @@ -70,6 +71,9 @@ class LogWriter implements Runnable { } finally { try { Thread.sleep(100); } catch (InterruptedException ie) {} } + } + + private void rereadConfig() { long now = Clock.getInstance().now(); if (now - _lastReadConfig > CONFIG_READ_ITERVAL) { _manager.rereadConfig(); @@ -94,7 +98,9 @@ class LogWriter implements Runnable { if (val == null) return; 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 { _currentOut.write(b); _numBytesInCurrentFile += b.length;