From b8645437a52654515eab0a5ee818d3bef75f65a7 Mon Sep 17 00:00:00 2001 From: Spencer Fang Date: Thu, 19 Oct 2017 16:43:31 -0700 Subject: [PATCH 1/2] netty: separate connection log Move netty connection log info to a separate logger: io.grpc.netty.NettyServerTransport.connections Users can redirect or disable this log using the usual way: -Djava.util.logging.config.file="logging.properties" Related to #1768, #3575 --- netty/src/main/java/io/grpc/netty/NettyServerTransport.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/netty/src/main/java/io/grpc/netty/NettyServerTransport.java b/netty/src/main/java/io/grpc/netty/NettyServerTransport.java index 6f2c308d541..38703fa2d7e 100644 --- a/netty/src/main/java/io/grpc/netty/NettyServerTransport.java +++ b/netty/src/main/java/io/grpc/netty/NettyServerTransport.java @@ -39,6 +39,8 @@ */ class NettyServerTransport implements ServerTransport { private static final Logger log = Logger.getLogger(NettyServerTransport.class.getName()); + private static final Logger connectionLog = Logger.getLogger( + String.format("%s.connections", NettyServerTransport.class.getName())); // Some exceptions are not very useful and add too much noise to the log private static final ImmutableList QUIET_ERRORS = ImmutableList.of( "Connection reset by peer", @@ -156,7 +158,7 @@ static Level getLogLevel(Throwable t) { private void notifyTerminated(Throwable t) { if (t != null) { - log.log(getLogLevel(t), "Transport failed", t); + connectionLog.log(getLogLevel(t), "Transport failed", t); } if (!terminated) { terminated = true; From 2cb4a4e8528b5377e6e069656c070a11b03be310 Mon Sep 17 00:00:00 2001 From: Spencer Fang Date: Fri, 27 Oct 2017 12:30:56 -0700 Subject: [PATCH 2/2] @SuppressWarning and add comment --- netty/src/main/java/io/grpc/netty/NettyServerTransport.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/netty/src/main/java/io/grpc/netty/NettyServerTransport.java b/netty/src/main/java/io/grpc/netty/NettyServerTransport.java index 38703fa2d7e..afb124c8239 100644 --- a/netty/src/main/java/io/grpc/netty/NettyServerTransport.java +++ b/netty/src/main/java/io/grpc/netty/NettyServerTransport.java @@ -38,7 +38,9 @@ * The Netty-based server transport. */ class NettyServerTransport implements ServerTransport { + @SuppressWarnings("unused") // log is for general messages, but nothing currently uses it private static final Logger log = Logger.getLogger(NettyServerTransport.class.getName()); + // connectionLog is for connection related messages only private static final Logger connectionLog = Logger.getLogger( String.format("%s.connections", NettyServerTransport.class.getName())); // Some exceptions are not very useful and add too much noise to the log