瀏覽代碼

HDFS-12805. Ozone: Redundant characters printed in exception log. Contributed by Yiqun Lin.

Xiaoyu Yao 7 年之前
父節點
當前提交
a61aafdf69

+ 2 - 2
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/BucketProcessTemplate.java

@@ -99,7 +99,7 @@ public abstract class BucketProcessTemplate {
       return response;
 
     } catch (IllegalArgumentException argEx) {
-      LOG.error("Invalid bucket. ex:{}", argEx);
+      LOG.error("Invalid bucket.", argEx);
       throw ErrorTable.newError(ErrorTable.INVALID_BUCKET_NAME, userArgs,
           argEx);
     } catch (IOException fsExp) {
@@ -149,7 +149,7 @@ public abstract class BucketProcessTemplate {
    */
   void handleIOException(String bucket, String reqID, String hostName,
                          IOException fsExp) throws OzoneException {
-    LOG.error("IOException: {}", fsExp);
+    LOG.error("IOException:", fsExp);
 
     OzoneException exp = null;
     if (fsExp instanceof FileAlreadyExistsException) {

+ 3 - 3
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/KeyProcessTemplate.java

@@ -94,10 +94,10 @@ public abstract class KeyProcessTemplate {
       return response;
 
     } catch (IllegalArgumentException argExp) {
-      LOG.error("Invalid bucket in key call. ex:{}", argExp);
+      LOG.error("Invalid bucket in key call.", argExp);
       throw newError(INVALID_BUCKET_NAME, userArgs, argExp);
     } catch (IOException fsExp) {
-      LOG.error("IOException. ex : {}", fsExp);
+      LOG.error("IOException:", fsExp);
       // Map KEY_NOT_FOUND to INVALID_KEY
       if (fsExp.getMessage().endsWith(
           KeySpaceManagerProtocolProtos.Status.KEY_NOT_FOUND.name())) {
@@ -109,7 +109,7 @@ public abstract class KeyProcessTemplate {
       throw ErrorTable.newError(ErrorTable.SERVER_ERROR, userArgs, fsExp);
     } catch (NoSuchAlgorithmException algoEx) {
       LOG.error("NoSuchAlgorithmException. Probably indicates an unusual java "
-          + "installation.  ex : {}", algoEx);
+          + "installation.", algoEx);
       throw ErrorTable.newError(SERVER_ERROR, userArgs, algoEx);
     }
   }

+ 5 - 6
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/VolumeProcessTemplate.java

@@ -97,7 +97,7 @@ public abstract class VolumeProcessTemplate {
       return response;
 
     } catch (IllegalArgumentException ex) {
-      LOG.error("illegal argument. {}", ex);
+      LOG.error("Illegal argument.", ex);
       throw ErrorTable.newError(ErrorTable.INVALID_VOLUME_NAME, userArgs, ex);
     } catch (IOException ex) {
       handleIOException(volume, reqID, hostName, ex);
@@ -130,7 +130,7 @@ public abstract class VolumeProcessTemplate {
    */
   private void handleIOException(String volume, String reqID, String hostName,
                                  IOException fsExp) throws OzoneException {
-    LOG.error("IOException: {}", fsExp);
+    LOG.error("IOException:", fsExp);
     OzoneException exp = null;
 
     if ((fsExp != null && fsExp.getMessage().endsWith(
@@ -178,7 +178,7 @@ public abstract class VolumeProcessTemplate {
     try {
       args.setQuota(quota);
     } catch (IllegalArgumentException ex) {
-      LOG.debug("Malformed Quota: {}", ex);
+      LOG.debug("Malformed Quota.", ex);
       throw ErrorTable.newError(ErrorTable.MALFORMED_QUOTA, args, ex);
     }
   }
@@ -235,7 +235,7 @@ public abstract class VolumeProcessTemplate {
       ListVolumes volumes = fs.listVolumes(listArgs);
       return OzoneUtils.getResponse(user, HTTP_OK, volumes.toJsonString());
     } catch (IOException ex) {
-      LOG.debug("unable to get the volume list for the user. Ex: {}", ex);
+      LOG.debug("unable to get the volume list for the user.", ex);
       OzoneException exp = ErrorTable.newError(ErrorTable.SERVER_ERROR,
           user, ex);
       exp.setMessage("unable to get the volume list for the user");
@@ -264,8 +264,7 @@ public abstract class VolumeProcessTemplate {
       ListBuckets bucketList = fs.listBuckets(listArgs);
       return OzoneUtils.getResponse(args, HTTP_OK, bucketList.toJsonString());
     } catch (IOException ex) {
-      LOG.debug("unable to get the bucket list for the specified volume." +
-          " Ex: {}", ex);
+      LOG.debug("unable to get the bucket list for the specified volume.", ex);
       OzoneException exp =
           ErrorTable.newError(ErrorTable.SERVER_ERROR, args, ex);
       exp.setMessage("unable to get the bucket list for the specified volume.");