when I destroy bean, I can not check error log.
my logback configuration is
<logger name="com.company" level="DEBUG"/>
<root level="ERROR">
<appender-ref ref="STDOUT" />
</root>
bean destroy method
@PreDestroy
void destory() {
throw new RuntimeException("message");
}
console log
09:27:45.932 [Thread-8] INFO o.s.b.f.s.DisposableBeanAdapter - Destroy method 'destroy' on bean with name 'sqsReceiver' threw an exception: java.lang.RuntimeException: message
I couldn't see logs because my configuration of 'org.springframework' is 'ERROR'. I waste lots of time on debugging.
would you explain spring logging rules?
and i think configuration for log level might be "warn" or "error" rather than log lovel "info".(DisposableBeanAdapter invokeCustomDestroyMethod)
I pull requested to https://github.com/spring-projects/spring-framework/pull/23200
Comment From: snicoll
The related PR was merged. The framework tries to be a good citizen so that WARN is a reasonable tradeoff. The level you apply depends certainly on the environment and the lifecycle of the application.