Description
Jake Robb opened SPR-17549 and commented
I have a bean that is failing to initialize and throwing an exception. The cause of the cause of the cause of that exception is the real, underlying issue.
The exception propagates to AbstractApplicationContext.refresh, at which point it is logged as a warning:
if (logger.isWarnEnabled()) {
logger.warn("Exception encountered during context initialization - " +
"cancelling refresh attempt: " + ex);
}
Note that the exception is being string-concatenated (and therefore toString'd), rather than passing the exception itself to the logger. This means that only the exception's type and message get written to the log, which in turn means that I only learn that my bean failed to initialize, but not why. It also means I get no stacktrace.
The fix here is to replace the +
with a ,
. I'll be submitting a pull request shortly.
Affects: 5.0.4, 5.0.11
Issue Links:
- Revisit BeansException warn logging after startup failure [SPR-13663] #18238 Revisit BeansException warn logging after startup failure