diff --git a/java/google/registry/proxy/handler/HttpsRelayServiceHandler.java b/java/google/registry/proxy/handler/HttpsRelayServiceHandler.java index f40963f3c..917934294 100644 --- a/java/google/registry/proxy/handler/HttpsRelayServiceHandler.java +++ b/java/google/registry/proxy/handler/HttpsRelayServiceHandler.java @@ -17,6 +17,7 @@ package google.registry.proxy.handler; import static com.google.common.base.Preconditions.checkArgument; import static java.nio.charset.StandardCharsets.UTF_8; +import com.google.common.base.Throwables; import com.google.common.flogger.FluentLogger; import google.registry.proxy.metric.FrontendMetrics; import io.netty.buffer.ByteBuf; @@ -154,7 +155,7 @@ abstract class HttpsRelayServiceHandler extends ByteToMessageCodec { if (!channelFuture.isSuccess()) { - logger.atSevere().withCause(channelFuture.cause()).log( - "Outbound exception caught for channel %s", channelFuture.channel()); + Throwable cause = channelFuture.cause(); + // If the failure is caused by IllegalArgumentException, we know that it is because we + // got a non 200 response. This is an expected error from the backend and should not be + // logged at severe. + if (Throwables.getRootCause(cause) instanceof IllegalArgumentException) { + logger.atWarning().withCause(channelFuture.cause()).log( + "Outbound exception caught for channel %s", channelFuture.channel()); + } else { + logger.atSevere().withCause(channelFuture.cause()).log( + "Outbound exception caught for channel %s", channelFuture.channel()); + } ChannelFuture unusedFuture = channelFuture.channel().close(); } });