You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (JIRA)" <ji...@apache.org> on 2015/07/30 17:58:05 UTC

[jira] [Commented] (SLING-3498) Don't log stacktrace on IOException

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

Bertrand Delacretaz commented on SLING-3498:
--------------------------------------------

The problem is that this hides legit IOException thrown by application code, as we don't expect users to run with debug log level active in production. I have asked for opinions on dl-dev in the "SlingMainServlet (almost) eats IOException, how to fix?" thread.

> Don't log stacktrace on IOException
> -----------------------------------
>
>                 Key: SLING-3498
>                 URL: https://issues.apache.org/jira/browse/SLING-3498
>             Project: Sling
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: Engine 2.3.2
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: Engine 2.3.4
>
>
> The SlingMainServlet logs IOExceptions depending on the actual cause:
> {code}
> } catch (IOException ioe) {
>     // unwrap any causes (Jetty wraps SocketException in
>     // EofException)
>     Throwable cause = ioe;
>     while (cause.getCause() != null) {
>         cause = cause.getCause();
>     }
>     if (cause instanceof SocketException) {
>         // if the cause is a SocketException, the client most
>         // probably
>         // aborted the request, we do not fill the log with errors
>         // in this case
>         log.debug(
>             "service: Socketexception (Client abort or network problem",
>             ioe);
>     } else {
>         // otherwise we want to know why the servlet failed
>         log.error(
>             "service: Uncaught IO Problem while handling the request",
>             ioe);
>     }
> } ...
> {code}
> The idea is to try to find out, whether the IOException is caused by the client aborting the request or some other problem.
> NIO socket channels, though, don't throw SocketException but just IOException in this case, so this above code will always log an ERROR message with a stack trace. This message has no real use and we should change this and log the IOException as an INFO message (if at all) and at most dump the stack trace as a DEBUG message.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)