HDFS-14371. Improve Logging in FSNamesystem by adding parameterized logging. Contributed by Shweta.

Signed-off-by: Wei-Chiu Chuang <weichiu@apache.org>
This commit is contained in:
Shweta 2019-04-05 16:08:05 -07:00 committed by Wei-Chiu Chuang
parent dc013f7a35
commit e9b859f749
1 changed files with 7 additions and 16 deletions

View File

@ -2413,10 +2413,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
for (CryptoProtocolVersion c : supportedVersions) {
if (c.equals(CryptoProtocolVersion.UNKNOWN)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Ignoring unknown CryptoProtocolVersion provided by " +
"client: " + c.getUnknownValue());
}
LOG.debug("Ignoring unknown CryptoProtocolVersion provided by " +
"client: {}", c.getUnknownValue());
continue;
}
if (c.equals(required)) {
@ -3693,9 +3691,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
if (deleteblock) {
// This may be a retry attempt so ignore the failure
// to locate the block.
if (LOG.isDebugEnabled()) {
LOG.debug("Block (=" + oldBlock + ") not found");
}
LOG.debug("Block (={}) not found", oldBlock);
return;
} else {
throw new IOException("Block (=" + oldBlock + ") not found");
@ -3729,9 +3725,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
if ((!iFile.isUnderConstruction() || storedBlock.isComplete()) &&
iFile.getLastBlock().isComplete()) {
if (LOG.isDebugEnabled()) {
LOG.debug("Unexpected block (=" + oldBlock
+ ") since the file (=" + iFile.getLocalName()
+ ") is not under construction");
LOG.debug("Unexpected block (={}) since the file (={}) is not "
+ "under construction", oldBlock, iFile.getLocalName());
}
return;
}
@ -5636,9 +5631,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
}
}
cookieTab[0] = String.valueOf(skip);
if (LOG.isDebugEnabled()) {
LOG.debug("list corrupt file blocks returned: " + count);
}
LOG.debug("list corrupt file blocks returned: {}", count);
return corruptFiles;
} finally {
readUnlock("listCorruptFileBlocks");
@ -6370,9 +6363,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
}
}
} catch (StandbyException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Get corrupt file blocks returned error: " + e.getMessage());
}
LOG.debug("Get corrupt file blocks returned error: {}", e.getMessage());
} catch (IOException e) {
LOG.warn("Get corrupt file blocks returned error", e);
}