diff --git a/core/java/src/net/i2p/util/Log.java b/core/java/src/net/i2p/util/Log.java index 0a03e19b5efee99099d1d86fc2cd6caa5d5c32e4..538e3986b98e2faefb6bb1262623e42daaa2662c 100644 --- a/core/java/src/net/i2p/util/Log.java +++ b/core/java/src/net/i2p/util/Log.java @@ -16,7 +16,7 @@ import net.i2p.I2PAppContext; /** * Wrapper class for whatever logging system I2P uses. This class should be * instantiated and kept as a variable for each class it is used by, ala: - * <code>private final static Log _log = new Log(MyClassName.class);</code> + * <code>private final Log _log = context.logManager().getLog(MyClassName.class);</code> * * If there is anything in here that doesn't make sense, turn off your computer * and go fly a kite. diff --git a/core/java/src/net/i2p/util/SimpleTimer2.java b/core/java/src/net/i2p/util/SimpleTimer2.java index ab568d64466823225a04bc66ad2e1d32d8eda7c1..8e2aee8a746407871e0f9f1d49a66b3e5bce25f8 100644 --- a/core/java/src/net/i2p/util/SimpleTimer2.java +++ b/core/java/src/net/i2p/util/SimpleTimer2.java @@ -31,7 +31,6 @@ public class SimpleTimer2 { private static final int MIN_THREADS = 2; private static final int MAX_THREADS = 4; private final I2PAppContext _context; - private static Log _log; // static so TimedEvent can use it private final ScheduledThreadPoolExecutor _executor; private final String _name; private int _count; @@ -40,7 +39,6 @@ public class SimpleTimer2 { protected SimpleTimer2() { this("SimpleTimer2"); } protected SimpleTimer2(String name) { _context = I2PAppContext.getGlobalContext(); - _log = _context.logManager().getLog(SimpleTimer2.class); _name = name; _count = 0; long maxMemory = Runtime.getRuntime().maxMemory(); @@ -79,8 +77,10 @@ public class SimpleTimer2 { @Override protected void afterExecute(Runnable r, Throwable t) { super.afterExecute(r, t); - if (t != null) // shoudn't happen, caught in RunnableEvent.run() - _log.log(Log.CRIT, "wtf, event borked: " + r, t); + if (t != null) { // shoudn't happen, caught in RunnableEvent.run() + Log log = I2PAppContext.getGlobalContext().logManager().getLog(SimpleTimer2.class); + log.log(Log.CRIT, "wtf, event borked: " + r, t); + } } } @@ -126,6 +126,7 @@ public class SimpleTimer2 { * */ public static abstract class TimedEvent implements Runnable { + private final Log _log; private SimpleTimer2 _pool; private int _fuzz; protected static final int DEFAULT_FUZZ = 3; @@ -136,7 +137,9 @@ public class SimpleTimer2 { public TimedEvent(SimpleTimer2 pool) { _pool = pool; _fuzz = DEFAULT_FUZZ; + _log = I2PAppContext.getGlobalContext().logManager().getLog(SimpleTimer2.class); } + /** automatically schedules, don't use this one if you have other things to do first */ public TimedEvent(SimpleTimer2 pool, long timeoutMs) { this(pool);