You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MonitoredJob#handleExceptionSafely logs the fact that an exception occurred at WARN level. For a job named "MyJob", the log message looks like:
Encountered exception in job: MyJob
MonitoredJob implements kiwi's CatchingRunnable, which logs the actual exception. But, we should change the message so that it provides information about the exception type, message, and possibly cause and/or root cause so that it can be correlated with the error and exception stack trace logged by CatchingRunnable.
In a recent problem, I was debugging a job that threw an org.kiwiproject.concurrent.AsyncException, which was caused by a java.util.concurrent.ExecutionException, which had a root cause of java.lang.NullPointerException.
Instead of the above error message, it would have been more useful to see a message like:
Encountered org.kiwiproject.concurrent.AsyncException exception in job 'MyJob' with root
cause java.lang.NullPointerException (look for the exception and stack trace logged by
CatchingRunnable#runSafely)
So, this tells you at a glance what the exception and root cause were, and also that you can find the exception information and stack trace that was logged by CatchingRunnable.
The text was updated successfully, but these errors were encountered:
sleberknight
changed the title
Log exceptions in MonitoredJob at DEBUG level
Enhance exception logging in MonitoredJob#handleExceptionSafely
Oct 26, 2023
* Enhance messages logged by handleExceptionSafely to include the
exception type, and if present, the root cause. Also mention that
the stack trace logged by CatchingRunnable will be ABOVE this
log message.
* Add 'tests' which exercise the two causes - an Exception with
a separate root cause, and one without one, i.e. such that
the root cause is itself.
Closes#391
* Enhance messages logged by handleExceptionSafely to include the
exception type, and if present, the root cause. Also mention that
the stack trace logged by CatchingRunnable will be ABOVE this
log message.
* Add 'tests' which exercise the two causes - an Exception with
a separate root cause, and one without one, i.e. such that
the root cause is itself.
Closes#391
MonitoredJob#handleExceptionSafely
logs the fact that an exception occurred atWARN
level. For a job named "MyJob", the log message looks like:MonitoredJob
implements kiwi'sCatchingRunnable
, which logs the actual exception. But, we should change the message so that it provides information about the exception type, message, and possibly cause and/or root cause so that it can be correlated with the error and exception stack trace logged byCatchingRunnable
.In a recent problem, I was debugging a job that threw an
org.kiwiproject.concurrent.AsyncException
, which was caused by ajava.util.concurrent.ExecutionException
, which had a root cause ofjava.lang.NullPointerException
.Instead of the above error message, it would have been more useful to see a message like:
So, this tells you at a glance what the exception and root cause were, and also that you can find the exception information and stack trace that was logged by
CatchingRunnable
.The text was updated successfully, but these errors were encountered: