Skip to content

Commit e9b859f

Browse files
Shwetajojochuang
authored andcommitted
HDFS-14371. Improve Logging in FSNamesystem by adding parameterized logging. Contributed by Shweta.
Signed-off-by: Wei-Chiu Chuang <weichiu@apache.org>
1 parent dc013f7 commit e9b859f

File tree

1 file changed

+7
-16
lines changed
  • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode

1 file changed

+7
-16
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,10 +2413,8 @@ CryptoProtocolVersion chooseProtocolVersion(
24132413

24142414
for (CryptoProtocolVersion c : supportedVersions) {
24152415
if (c.equals(CryptoProtocolVersion.UNKNOWN)) {
2416-
if (LOG.isDebugEnabled()) {
2417-
LOG.debug("Ignoring unknown CryptoProtocolVersion provided by " +
2418-
"client: " + c.getUnknownValue());
2419-
}
2416+
LOG.debug("Ignoring unknown CryptoProtocolVersion provided by " +
2417+
"client: {}", c.getUnknownValue());
24202418
continue;
24212419
}
24222420
if (c.equals(required)) {
@@ -3693,9 +3691,7 @@ void commitBlockSynchronization(ExtendedBlock oldBlock,
36933691
if (deleteblock) {
36943692
// This may be a retry attempt so ignore the failure
36953693
// to locate the block.
3696-
if (LOG.isDebugEnabled()) {
3697-
LOG.debug("Block (=" + oldBlock + ") not found");
3698-
}
3694+
LOG.debug("Block (={}) not found", oldBlock);
36993695
return;
37003696
} else {
37013697
throw new IOException("Block (=" + oldBlock + ") not found");
@@ -3729,9 +3725,8 @@ void commitBlockSynchronization(ExtendedBlock oldBlock,
37293725
if ((!iFile.isUnderConstruction() || storedBlock.isComplete()) &&
37303726
iFile.getLastBlock().isComplete()) {
37313727
if (LOG.isDebugEnabled()) {
3732-
LOG.debug("Unexpected block (=" + oldBlock
3733-
+ ") since the file (=" + iFile.getLocalName()
3734-
+ ") is not under construction");
3728+
LOG.debug("Unexpected block (={}) since the file (={}) is not "
3729+
+ "under construction", oldBlock, iFile.getLocalName());
37353730
}
37363731
return;
37373732
}
@@ -5636,9 +5631,7 @@ Collection<CorruptFileBlockInfo> listCorruptFileBlocks(String path,
56365631
}
56375632
}
56385633
cookieTab[0] = String.valueOf(skip);
5639-
if (LOG.isDebugEnabled()) {
5640-
LOG.debug("list corrupt file blocks returned: " + count);
5641-
}
5634+
LOG.debug("list corrupt file blocks returned: {}", count);
56425635
return corruptFiles;
56435636
} finally {
56445637
readUnlock("listCorruptFileBlocks");
@@ -6370,9 +6363,7 @@ private List<String> getCorruptFilesList() {
63706363
}
63716364
}
63726365
} catch (StandbyException e) {
6373-
if (LOG.isDebugEnabled()) {
6374-
LOG.debug("Get corrupt file blocks returned error: " + e.getMessage());
6375-
}
6366+
LOG.debug("Get corrupt file blocks returned error: {}", e.getMessage());
63766367
} catch (IOException e) {
63776368
LOG.warn("Get corrupt file blocks returned error", e);
63786369
}

0 commit comments

Comments
 (0)