Core: Remove log4j exception hiding
At some time in the distant past, Bootstrap could be used by those embedding elasticsearch. However, it is no longer allowed (now package private), and so any errors (for example, log4j missing, or any other exception while initializing) should be exposed directly and cause elasticsearch to fail to start. This change removes hiding of logging initialization exceptions.
This commit is contained in:
parent
ba5be0332d
commit
9c259aca41
|
@ -193,21 +193,6 @@ final class Bootstrap {
|
||||||
node = new Node(nodeSettings);
|
node = new Node(nodeSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressForbidden(reason = "Exception#printStackTrace()")
|
|
||||||
private static void setupLogging(Settings settings) {
|
|
||||||
try {
|
|
||||||
Class.forName("org.apache.log4j.Logger");
|
|
||||||
LogConfigurator.configure(settings, true);
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
// no log4j
|
|
||||||
} catch (NoClassDefFoundError e) {
|
|
||||||
// no log4j
|
|
||||||
} catch (Exception e) {
|
|
||||||
sysError("Failed to configure logging...", false);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Environment initialSettings(boolean foreground) {
|
private static Environment initialSettings(boolean foreground) {
|
||||||
Terminal terminal = foreground ? Terminal.DEFAULT : null;
|
Terminal terminal = foreground ? Terminal.DEFAULT : null;
|
||||||
return InternalSettingsPreparer.prepareEnvironment(EMPTY_SETTINGS, terminal);
|
return InternalSettingsPreparer.prepareEnvironment(EMPTY_SETTINGS, terminal);
|
||||||
|
@ -254,7 +239,7 @@ final class Bootstrap {
|
||||||
|
|
||||||
Environment environment = initialSettings(foreground);
|
Environment environment = initialSettings(foreground);
|
||||||
Settings settings = environment.settings();
|
Settings settings = environment.settings();
|
||||||
setupLogging(settings);
|
LogConfigurator.configure(settings, true);
|
||||||
checkForCustomConfFile();
|
checkForCustomConfFile();
|
||||||
|
|
||||||
if (environment.pidFile() != null) {
|
if (environment.pidFile() != null) {
|
||||||
|
|
Loading…
Reference in New Issue