Skip to content

Make SimpleDataFetcherExceptionHandler error logging configurable/overridable (or remove) #2564

Closed

Description

@tatu-at-datastax

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).

Activity

  1. added this to the 18.0 milestone on Oct 2, 2021
  2. tatu-at-datastax commented on Oct 4, 2021

    @tatu-at-datastax
    Author

    Thank you @bbakerman !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions