From 6810e959f9d1e15b197e65c6b7d4a8cc7d09d0a1 Mon Sep 17 00:00:00 2001 From: jianglai Date: Mon, 6 Aug 2018 10:02:41 -0700 Subject: [PATCH] Refine logs in the proxy [1] All logs should contain a reference to the channel so that it is easy to search for logs about a specific channel. [2] EPP ssl handshake failure should be logged at warning. It is mostly the client that failed to complete the handshake, for example by sending bad cert, or not sending cert, or not using the correct SSL version. We should not lot it at error and spam the log. [3] When the EPP response is not 200, we should not log at error because it means that the GAE app responded successfully. For example when datastore contention occurs, app engine responds with a non-200 status and logs at warning. The proxy should not at a higher level than app engine itself. [4] Timeout is a non-fatal error that should be logged at warning. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=207562299 --- .../proxy/handler/EppServiceHandler.java | 2 +- .../proxy/handler/HttpsRelayServiceHandler.java | 17 ++++++++++++++--- .../proxy/handler/ProxyProtocolHandler.java | 14 +++++++++----- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/java/google/registry/proxy/handler/EppServiceHandler.java b/java/google/registry/proxy/handler/EppServiceHandler.java index 15b6f9a06..7c57f5251 100644 --- a/java/google/registry/proxy/handler/EppServiceHandler.java +++ b/java/google/registry/proxy/handler/EppServiceHandler.java @@ -118,7 +118,7 @@ public class EppServiceHandler extends HttpsRelayServiceHandler { "epp", sslClientCertificateHash, ctx.channel()); channelRead(ctx, Unpooled.wrappedBuffer(helloBytes)); } else { - logger.atSevere().withCause(promise.cause()).log( + logger.atWarning().withCause(promise.cause()).log( "Cannot finish handshake for channel %s", ctx.channel()); ChannelFuture unusedFuture = ctx.close(); } diff --git a/java/google/registry/proxy/handler/HttpsRelayServiceHandler.java b/java/google/registry/proxy/handler/HttpsRelayServiceHandler.java index 4e6974aff..6de1e8670 100644 --- a/java/google/registry/proxy/handler/HttpsRelayServiceHandler.java +++ b/java/google/registry/proxy/handler/HttpsRelayServiceHandler.java @@ -34,6 +34,7 @@ import io.netty.handler.codec.http.HttpVersion; import io.netty.handler.codec.http.cookie.ClientCookieDecoder; import io.netty.handler.codec.http.cookie.ClientCookieEncoder; import io.netty.handler.codec.http.cookie.Cookie; +import io.netty.handler.timeout.ReadTimeoutException; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -152,8 +153,9 @@ abstract class HttpsRelayServiceHandler extends ByteToMessageCodec