Log RuntimeException thrown from a thread created by Spring via @Async annotation

I am having difficulty logging a RuntimeException from a thread. My system: Java 7 (b118), Spring 3.0.5. Threads are not created manually, but through the Spring @Async annotation, which creates its own performer behind the scenes, so I have no way to override any stream methods, FutureTask or something low. So my question is, does Spring or any recommendations for handling (registering) these types of exceptions? Any suggestions are welcome. Thank you

+4
source share
1 answer

It looks like AsyncAnnotationBeanPostProcessor and <task:annotation-driven> can come with a custom Executor , so you can configure logging through ThreadFactory .

+2
source

Source: https://habr.com/ru/post/1333357/


All Articles