-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
With the latest versions, SimpleDataFetcherExceptionHandler both handles and returns failure information (makes sense) and also always logs it as an error (which to me does not usually make sense, although I can see how some might want that).
Further, failure is logged along with exception with result of lots of log noise for most cases where exception message along is sufficient and origins of exception are of no interest, for us least.
I know that it is possible to configure logging to try to remove this output (although it being at WARN level, it is also bit awkward conceptually). But since this is a handler it seems like ability to either configure behavior, or, perhaps, just overridability, would suffice.
So the simplest change would be to extract line:
logNotSafe.warn(error.getMessage(), exception);
into a protected non-static helper method like:
protected void logException(ExceptionWhileDataFetching error, Throwable source)
{
logNotSafe.warn(error.getMessage(), exception);
}
called from onException().
Doing this would allow developers to override the default implementation and change handling wrt logging level, inclusion of information; or even just not logging at all (since it will be further handled at higher levels anyway).