Log exception before sending to listeners

Change SpringApplication exception handling to log details before calling
the SpringApplicationRunListeners. Prior to this commit it wasn't possible
for a listener to shutdown logging.

Fixes gh-4680
Closes gh-4686
pull/4686/merge
Jean de Klerk 9 years ago committed by Phillip Webb
parent 80b305015e
commit e9eae2cc1e

@ -819,6 +819,10 @@ public class SpringApplication {
private void handleRunFailure(ConfigurableApplicationContext context,
SpringApplicationRunListeners listeners, Throwable exception) {
if (this.log.isErrorEnabled()) {
this.log.error("Application startup failed", exception);
registerLoggedException(exception);
}
try {
try {
listeners.finished(context, exception);
@ -832,10 +836,6 @@ public class SpringApplication {
catch (Exception ex) {
this.log.warn("Unable to close ApplicationContext", ex);
}
if (this.log.isErrorEnabled()) {
this.log.error("Application startup failed", exception);
registerLoggedException(exception);
}
ReflectionUtils.rethrowRuntimeException(exception);
}

Loading…
Cancel
Save