Closed
Description
Stack trace is logged as one line when an exception happens during context initialization. This makes it difficult to read and it can not be formatted by log patterns.
I am using default Spring Boot configuration with no logging properties set.
To reproduce:
Add this line in any bean constructor: if (true) throw new RuntimeException();
Result:
2018-08-23 10:49:10.778 WARN 21110 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redacted' defined in file [/redacted/path/to/file]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redacted' defined in file [/redacted/path/to/file]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLSchemaBuilder' defined in file [/redacted/path/to/file]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redacted' defined in file [/redacted/path/to/file]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [/redacted/path/to/file]: Constructor threw exception; nested exception is java.lang.RuntimeException
2018-08-23 10:49:10.779 INFO 21110 --- [ restartedMain] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'taskScheduler'
I even tracked down the commit that caused this issue:
spring-projects/spring-framework@cdf6eb9
I propose to revert this commit. I have never seen exceptions being duplicated in my logs before.