From a7dbd3b6f978d28ef7e046add2e3270ae3d9d9f6 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein <50450311+amahussein@users.noreply.github.com> Date: Thu, 3 Dec 2020 17:14:40 -0600 Subject: [PATCH] HDFS-15706. HttpFS: Log more information on request failures. (#2515) (cherry picked from commit 07655a7040806c4c9687288de89e42cfacf0365e) --- .../hadoop/fs/http/server/HttpFSExceptionProvider.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSExceptionProvider.java b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSExceptionProvider.java index 8d30182736..4739e42137 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSExceptionProvider.java +++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSExceptionProvider.java @@ -70,12 +70,16 @@ public Response toResponse(Throwable throwable) { status = Response.Status.NOT_FOUND; } else if (throwable instanceof IOException) { status = Response.Status.INTERNAL_SERVER_ERROR; + logErrorFully(status, throwable); } else if (throwable instanceof UnsupportedOperationException) { status = Response.Status.BAD_REQUEST; + logErrorFully(status, throwable); } else if (throwable instanceof IllegalArgumentException) { status = Response.Status.BAD_REQUEST; + logErrorFully(status, throwable); } else { status = Response.Status.INTERNAL_SERVER_ERROR; + logErrorFully(status, throwable); } return createResponse(status, throwable); } @@ -95,4 +99,7 @@ protected void log(Response.Status status, Throwable throwable) { LOG.warn("[{}:{}] response [{}] {}", method, path, status, message, throwable); } + private void logErrorFully(Response.Status status, Throwable throwable) { + LOG.debug("Failed with {}", status, throwable); + } }