Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-9049

JAXRSUtils: Logging Improvements

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 4.0.5
    • None
    • JAX-RS
    • None
    • Unknown

    Description

      Currently, during a write error of any kind, JAXRSUtils logs ERRORs like this:

      JAXRSUtils - Problem with writing the data, class com.acme.MyResponseType, ContentType: application/json
      

      We have the following issues with this:

      1. Because there's no stack trace, this error doesn't help us in identifying what went wrong.
      2. The log level is always ERROR, even for errors that aren't actionable, like when the client aborts the request before the server could send the response.

      This issue is related to CXF-7389, with the distinction of that issue being about log levels for API responses with HTTP error status codes. But here, I'd like to request a similar improvement but for response handling errors. This could allow us to maybe configure a property IOException.class.getName() + ".log.level" to reduce the log level for exceptions of our choosing.
      The logic that checks for these properties should then have to consider the type hierarchy to properly deal with subclasses of IOException, something like this snippet:

      Level determineLogLevel(Exception ex, Message m) {
        Class<?> exType = ex.getClass();
        do {
          String key = exType.getName() + ".log.level";
          if (m.containsKey(key)) {
            return Level.parseLevel(m.get(key).toString());
          }
          exType = exType.getSuperClass();
        } while (exType != Object.class);
        return someDefaultLevelPossiblyError;
      }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kzander Kai Zander
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: