Errors from a MethodInvokingJob are only logged at WARN/INFO level (and twice...) [SPR-4630] #9307
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Martin Probst opened SPR-4630 and commented
When a MethodInvokingJob scheduled by Quartz throws an exception, the error is logged twice, once at WARN level by the MethodInvokingJob wrapper, and once at INFO by Quartz.
This is because the MethodInvokingJob catches all exceptions thrown by the invoked method (InvocationTargetExceptions), and then re-throws them as JobExecutionExceptions. Quartz apparently considers those to be "expected exceptions" that are used for scheduling purposes, and as such they are only logged as INFO.
Spring's MethodInvokingJob should probably find out if the thrown exceptions was a runtime exception, and re-throw it, and simply wrap checked exceptions in an appropriate RuntimeException and rethrow them. JobExecutionExceptions are apparently reserved for other purposes.
Also, you should probably not log an exception that you are re-throwing anyways, that only gives duplicate log entries, making a potential problem harder to find.
Affects: 2.0.8, 2.5.1
Backported to: 2.0.9
The text was updated successfully, but these errors were encountered: