This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new e47b6f0 HDDS-6206. Application errors must not flood system log
(#3001)
e47b6f0 is described below
commit e47b6f0c35534270441307f0338ab8184d2e2fb5
Author: UENISHI Kota <[email protected]>
AuthorDate: Thu Feb 3 14:09:39 2022 +0900
HDDS-6206. Application errors must not flood system log (#3001)
---
.../org/apache/hadoop/ozone/s3/exception/S3ErrorTable.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git
a/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/exception/S3ErrorTable.java
b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/exception/S3ErrorTable.java
index 86d9fc0..70dcff1 100644
---
a/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/exception/S3ErrorTable.java
+++
b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/exception/S3ErrorTable.java
@@ -26,7 +26,7 @@ import static java.net.HttpURLConnection.HTTP_FORBIDDEN;
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
import static java.net.HttpURLConnection.HTTP_PRECON_FAILED;
import static java.net.HttpURLConnection.HTTP_NOT_IMPLEMENTED;
-import static java.net.HttpURLConnection.HTTP_SERVER_ERROR;
+import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;
import static org.apache.hadoop.ozone.s3.util.S3Consts.RANGE_NOT_SATISFIABLE;
/**
@@ -106,7 +106,7 @@ public final class S3ErrorTable {
public static final OS3Exception INTERNAL_ERROR = new OS3Exception(
"InternalError", "We encountered an internal error. Please try again.",
- HTTP_SERVER_ERROR);
+ HTTP_INTERNAL_ERROR);
public static final OS3Exception ACCESS_DENIED = new OS3Exception(
"AccessDenied", "User doesn't have the right to access this " +
@@ -130,7 +130,11 @@ public final class S3ErrorTable {
OS3Exception err = new OS3Exception(e.getCode(), e.getErrorMessage(),
e.getHttpCode());
err.setResource(resource);
- LOG.error(err.toXml(), e);
+ if (e.getHttpCode() == HTTP_INTERNAL_ERROR) {
+ LOG.error("Internal Error: {}", err.toXml(), e);
+ } else if (LOG.isDebugEnabled()) {
+ LOG.debug(err.toXml(), e);
+ }
return err;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]