You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Kai Zander (Jira)" <ji...@apache.org> on 2024/11/19 09:33:00 UTC

[jira] [Commented] (CXF-9049) JAXRSUtils: Logging Improvements

    [ https://issues.apache.org/jira/browse/CXF-9049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17899417#comment-17899417 ] 

Kai Zander commented on CXF-9049:
---------------------------------

[~reta] Thanks for the offer, but I don't think I would be able to properly implement this myself without a considerable time investment. The code snippet I provided in the description should be considered pseudo-code.

> 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
>            Priority: Minor
>
> 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)