HDFS-15706. HttpFS: Log more information on request failures. (#2515)

(cherry picked from commit 07655a7040)
(cherry picked from commit a7dbd3b6f9)
This commit is contained in:
Ahmed Hussein 2020-12-03 17:14:40 -06:00 committed by Wei-Chiu Chuang
parent 9fe779d0e2
commit f547cd43d1
1 changed files with 7 additions and 0 deletions

View File

@ -70,12 +70,16 @@ public class HttpFSExceptionProvider extends ExceptionProvider {
status = Response.Status.NOT_FOUND; status = Response.Status.NOT_FOUND;
} else if (throwable instanceof IOException) { } else if (throwable instanceof IOException) {
status = Response.Status.INTERNAL_SERVER_ERROR; status = Response.Status.INTERNAL_SERVER_ERROR;
logErrorFully(status, throwable);
} else if (throwable instanceof UnsupportedOperationException) { } else if (throwable instanceof UnsupportedOperationException) {
status = Response.Status.BAD_REQUEST; status = Response.Status.BAD_REQUEST;
logErrorFully(status, throwable);
} else if (throwable instanceof IllegalArgumentException) { } else if (throwable instanceof IllegalArgumentException) {
status = Response.Status.BAD_REQUEST; status = Response.Status.BAD_REQUEST;
logErrorFully(status, throwable);
} else { } else {
status = Response.Status.INTERNAL_SERVER_ERROR; status = Response.Status.INTERNAL_SERVER_ERROR;
logErrorFully(status, throwable);
} }
return createResponse(status, throwable); return createResponse(status, throwable);
} }
@ -95,4 +99,7 @@ public class HttpFSExceptionProvider extends ExceptionProvider {
LOG.warn("[{}:{}] response [{}] {}", new Object[]{method, path, status, message}, throwable); LOG.warn("[{}:{}] response [{}] {}", new Object[]{method, path, status, message}, throwable);
} }
private void logErrorFully(Response.Status status, Throwable throwable) {
LOG.debug("Failed with {}", status, throwable);
}
} }