Kai Zander created CXF-9049:
-------------------------------

             Summary: JAXRSUtils: Logging Improvements
                 Key: CXF-9049
                 URL: https://issues.apache.org/jira/browse/CXF-9049
             Project: CXF
          Issue Type: Wish
          Components: JAX-RS
    Affects Versions: 4.0.5
            Reporter: Kai Zander


Currently, during a write error _of any kind_, {{JAXRSUtils}} logs ERRORs like 
this:
{code:none}
JAXRSUtils - Problem with writing the data, class com.acme.MyResponseType, 
ContentType: application/json
{code}
We have the following issues with this:
# Because there's no stack trace, this error doesn't help us in identifying 
what went wrong.
# 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:
{code:java}
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;
}
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to