Improve console logging on startup exception
Today we show the exception twice: once by the logger and then again by the JVM. This is too noisy, and easy to avoid.
This commit is contained in:
parent
32a097382c
commit
f7f7fecafb
|
@ -277,11 +277,19 @@ public class Bootstrap {
|
||||||
closeSysError();
|
closeSysError();
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
// disable console logging, so user does not see the exception twice (jvm will show it already)
|
||||||
|
if (foreground) {
|
||||||
|
Loggers.disableConsoleLogging();
|
||||||
|
}
|
||||||
ESLogger logger = Loggers.getLogger(Bootstrap.class);
|
ESLogger logger = Loggers.getLogger(Bootstrap.class);
|
||||||
if (INSTANCE.node != null) {
|
if (INSTANCE.node != null) {
|
||||||
logger = Loggers.getLogger(Bootstrap.class, INSTANCE.node.settings().get("name"));
|
logger = Loggers.getLogger(Bootstrap.class, INSTANCE.node.settings().get("name"));
|
||||||
}
|
}
|
||||||
logger.error("Exception", e);
|
logger.error("Exception", e);
|
||||||
|
// re-enable it if appropriate, so they can see any logging during the shutdown process
|
||||||
|
if (foreground) {
|
||||||
|
Loggers.enableConsoleLogging();
|
||||||
|
}
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue