diff --git a/core/java/src/net/i2p/util/LogManager.java b/core/java/src/net/i2p/util/LogManager.java index b668580df..50852992e 100644 --- a/core/java/src/net/i2p/util/LogManager.java +++ b/core/java/src/net/i2p/util/LogManager.java @@ -150,14 +150,18 @@ public class LogManager implements Flushable { // so it doesn't create a log directory and log files unless there is output. // In the router context, we have to rotate to a new log file at startup or the logs.jsp // page will display the old log. - if (context.isRouterContext()) + if (context.isRouterContext()) { startLogWriter(); - try { - Runtime.getRuntime().addShutdownHook(new ShutdownHook()); - } catch (IllegalStateException ise) { - // shutdown in progress, fsck it + } else { + // Only in App Context. + // In Router Context, the router has its own shutdown hook, + // and will call our shutdown() from Router.finalShutdown() + try { + Runtime.getRuntime().addShutdownHook(new ShutdownHook()); + } catch (IllegalStateException ise) { + // shutdown in progress + } } - //System.out.println("Created logManager " + this + " with context: " + context); } /** @since 0.8.2 */