Переглянути джерело

HDFS-16199. Resolve log placeholders in NamenodeBeanMetrics (#3362). Contributed by Viraj Jasani.

Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
Viraj Jasani 3 роки тому
батько
коміт
cc6b545365

+ 28 - 40
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/NamenodeBeanMetrics.java

@@ -195,7 +195,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getUsedCapacity();
     } catch (IOException e) {
-      LOG.debug("Failed to get the used capacity", e.getMessage());
+      LOG.debug("Failed to get the used capacity", e);
     }
     return 0;
   }
@@ -205,7 +205,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getRemainingCapacity();
     } catch (IOException e) {
-      LOG.debug("Failed to get remaining capacity", e.getMessage());
+      LOG.debug("Failed to get remaining capacity", e);
     }
     return 0;
   }
@@ -215,7 +215,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getTotalCapacity();
     } catch (IOException e) {
-      LOG.debug("Failed to Get total capacity", e.getMessage());
+      LOG.debug("Failed to Get total capacity", e);
     }
     return 0;
   }
@@ -225,7 +225,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getProvidedSpace();
     } catch (IOException e) {
-      LOG.debug("Failed to get provided capacity", e.getMessage());
+      LOG.debug("Failed to get provided capacity", e);
     }
     return 0;
   }
@@ -292,7 +292,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumBlocks();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of blocks", e.getMessage());
+      LOG.debug("Failed to get number of blocks", e);
     }
     return 0;
   }
@@ -302,7 +302,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumOfMissingBlocks();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of missing blocks", e.getMessage());
+      LOG.debug("Failed to get number of missing blocks", e);
     }
     return 0;
   }
@@ -313,8 +313,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumOfBlocksPendingReplication();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of blocks pending replica",
-          e.getMessage());
+      LOG.debug("Failed to get number of blocks pending replica", e);
     }
     return 0;
   }
@@ -324,8 +323,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumOfBlocksPendingReplication();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of blocks pending replica",
-          e.getMessage());
+      LOG.debug("Failed to get number of blocks pending replica", e);
     }
     return 0;
   }
@@ -336,8 +334,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumOfBlocksUnderReplicated();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of blocks under replicated",
-          e.getMessage());
+      LOG.debug("Failed to get number of blocks under replicated", e);
     }
     return 0;
   }
@@ -347,8 +344,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumOfBlocksUnderReplicated();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of blocks under replicated",
-          e.getMessage());
+      LOG.debug("Failed to get number of blocks under replicated", e);
     }
     return 0;
   }
@@ -358,8 +354,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumOfBlocksPendingDeletion();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of blocks pending deletion",
-          e.getMessage());
+      LOG.debug("Failed to get number of blocks pending deletion", e);
     }
     return 0;
   }
@@ -369,8 +364,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getScheduledReplicationBlocks();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of scheduled replication blocks.",
-          e.getMessage());
+      LOG.debug("Failed to get number of scheduled replication blocks", e);
     }
     return 0;
   }
@@ -381,7 +375,7 @@ public class NamenodeBeanMetrics
       return getRBFMetrics().getNumberOfMissingBlocksWithReplicationFactorOne();
     } catch (IOException e) {
       LOG.debug("Failed to get number of missing blocks with replication "
-          + "factor one.", e.getMessage());
+          + "factor one.", e);
     }
     return 0;
   }
@@ -392,7 +386,7 @@ public class NamenodeBeanMetrics
       return getRBFMetrics().getHighestPriorityLowRedundancyReplicatedBlocks();
     } catch (IOException e) {
       LOG.debug("Failed to get number of highest priority low redundancy "
-          + "replicated blocks.", e.getMessage());
+          + "replicated blocks.", e);
     }
     return 0;
   }
@@ -403,8 +397,7 @@ public class NamenodeBeanMetrics
       return getRBFMetrics().getHighestPriorityLowRedundancyECBlocks();
     } catch (IOException e) {
       LOG.debug("Failed to get number of highest priority low redundancy EC "
-              + "blocks.",
-          e.getMessage());
+          + "blocks.", e);
     }
     return 0;
   }
@@ -419,7 +412,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getCorruptFilesCount();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of corrupt files.", e.getMessage());
+      LOG.debug("Failed to get number of corrupt files", e);
     }
     return 0;
   }
@@ -572,7 +565,7 @@ public class NamenodeBeanMetrics
     try {
       return getRouter().getStartTime();
     } catch (IOException e) {
-      LOG.debug("Failed to get the router startup time", e.getMessage());
+      LOG.debug("Failed to get the router startup time", e);
     }
     return 0;
   }
@@ -633,7 +626,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumFiles();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of files", e.getMessage());
+      LOG.debug("Failed to get number of files", e);
     }
     return 0;
   }
@@ -648,7 +641,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumLiveNodes();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of live nodes", e.getMessage());
+      LOG.debug("Failed to get number of live nodes", e);
     }
     return 0;
   }
@@ -658,7 +651,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumDeadNodes();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of dead nodes", e.getMessage());
+      LOG.debug("Failed to get number of dead nodes", e);
     }
     return 0;
   }
@@ -668,7 +661,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumStaleNodes();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of stale nodes", e.getMessage());
+      LOG.debug("Failed to get number of stale nodes", e);
     }
     return 0;
   }
@@ -679,7 +672,7 @@ public class NamenodeBeanMetrics
       return getRBFMetrics().getNumDecomLiveNodes();
     } catch (IOException e) {
       LOG.debug("Failed to get the number of live decommissioned datanodes",
-          e.getMessage());
+          e);
     }
     return 0;
   }
@@ -690,7 +683,7 @@ public class NamenodeBeanMetrics
       return getRBFMetrics().getNumDecomDeadNodes();
     } catch (IOException e) {
       LOG.debug("Failed to get the number of dead decommissioned datanodes",
-          e.getMessage());
+          e);
     }
     return 0;
   }
@@ -700,8 +693,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumDecommissioningNodes();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of decommissioning nodes",
-          e.getMessage());
+      LOG.debug("Failed to get number of decommissioning nodes", e);
     }
     return 0;
   }
@@ -711,8 +703,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumInMaintenanceLiveDataNodes();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of live in maintenance nodes",
-          e.getMessage());
+      LOG.debug("Failed to get number of live in maintenance nodes", e);
     }
     return 0;
   }
@@ -722,8 +713,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumInMaintenanceDeadDataNodes();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of dead in maintenance nodes",
-          e.getMessage());
+      LOG.debug("Failed to get number of dead in maintenance nodes", e);
     }
     return 0;
   }
@@ -733,8 +723,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().getNumEnteringMaintenanceDataNodes();
     } catch (IOException e) {
-      LOG.debug("Failed to get number of entering maintenance nodes",
-          e.getMessage());
+      LOG.debug("Failed to get number of entering maintenance nodes", e);
     }
     return 0;
   }
@@ -822,8 +811,7 @@ public class NamenodeBeanMetrics
     try {
       return getRBFMetrics().isSecurityEnabled();
     } catch (IOException e) {
-      LOG.debug("Failed to get security status.",
-          e.getMessage());
+      LOG.debug("Failed to get security status", e);
     }
     return false;
   }