forked from I2P_Developers/i2p.i2p
LogManager: Don't register runtime shutdown hook in router context.
This was causing shutdown() to be called twice, resulting in lost log messages when stopped from i2prouter.
This commit is contained in:
@ -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 */
|
||||
|
Reference in New Issue
Block a user