cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasobrown <...@git.apache.org>
Subject [GitHub] cassandra pull request #294: Fixing logging of netty client related ioexcept...
Date Thu, 29 Nov 2018 14:33:29 GMT
Github user jasobrown commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/294#discussion_r237509397
  
    --- Diff: src/java/org/apache/cassandra/transport/Message.java ---
    @@ -710,7 +710,7 @@ public boolean apply(Throwable exception)
                 boolean isIOException = exception instanceof IOException || (exception.getCause()
instanceof IOException);
                 if (!alwaysLogAtError && isIOException)
                 {
    -                if (ioExceptionsAtDebugLevel.contains(exception.getMessage()))
    +                if (ioExceptionsAtDebugLevel.stream().anyMatch(ioExceptionAtDebugLevel
-> exception.getMessage().contains(ioExceptionAtDebugLevel)))
    --- End diff --
    
    I'd prefer to avoid the streaming API as it creates a bunch of excess garbage. How about
something like this instead:
    
    ```java
                    // exceptions thrown from the netty epoll transport add the name of the
function that failed
                    // to the exception string (which is simply wrapping a JDK exception),
so we can't do a simple/naive comparison
                    String errorMessage = exception.getMessage();
                    boolean logAtTrace = false;
    
                    for (String s : ioExceptionsAtDebugLevel)
                    {
                        if (errorMessage.contains(s))
                        {
                            logAtTrace = true;
                            break;
                        }
                    }
    
                    if (logAtTrace)
                    {
                        // Likely unclean client disconnects
                        logger.trace(message, exception);
                    }
                    else
                    {
                        // Generally unhandled IO exceptions are network issues, not actual
ERRORS
                        logger.info(message, exception);
                    }
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message