HADOOP-7385 Remove StringUtils.stringifyException(ie) in logger functions. Contributed by Bharath Mundlapudi.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1139123 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tanping Wang 2011-06-23 23:55:30 +00:00
parent fd9997989c
commit 1191be630f
17 changed files with 26 additions and 36 deletions

View File

@ -227,6 +227,9 @@ Trunk (unreleased changes)
HADOOP-6929. RPC should have a way to pass Security information other than
protocol annotations. (sharad and omalley via mahadev)
HADOOP-7385. Remove StringUtils.stringifyException(ie) in logger functions.
(Bharath Mundlapudi via Tanping Wang).
OPTIMIZATIONS
HADOOP-7333. Performance improvement in PureJavaCrc32. (Eric Caspole

View File

@ -151,8 +151,7 @@ public abstract class ChecksumFileSystem extends FilterFileSystem {
set(fs.verifyChecksum, null, 1, 0);
} catch (IOException e) { // loudly ignore
LOG.warn("Problem opening checksum file: "+ file +
". Ignoring exception: " +
StringUtils.stringifyException(e));
". Ignoring exception: " , e);
set(fs.verifyChecksum, null, 1, 0);
}
}

View File

@ -142,8 +142,7 @@ public abstract class ChecksumFs extends FilterFs {
set(fs.verifyChecksum, null, 1, 0);
} catch (IOException e) { // loudly ignore
LOG.warn("Problem opening checksum file: "+ file +
". Ignoring exception: " +
StringUtils.stringifyException(e));
". Ignoring exception: " , e);
set(fs.verifyChecksum, null, 1, 0);
}
}

View File

@ -652,9 +652,9 @@ public class FileUtil {
try {
shExec.execute();
}catch(Exception e) {
if(LOG.isDebugEnabled()) {
LOG.debug("Error while changing permission : " + filename
+" Exception: " + StringUtils.stringifyException(e));
if (LOG.isDebugEnabled()) {
LOG.debug("Error while changing permission : " + filename
+ " Exception: ", e);
}
}
return shExec.getExitCode();

View File

@ -232,15 +232,14 @@ public class LocalDirAllocator {
dirs.add(localDirs[i]);
dfList.add(new DF(new File(localDirs[i]), 30000));
} catch (DiskErrorException de) {
LOG.warn( localDirs[i] + "is not writable\n" +
StringUtils.stringifyException(de));
LOG.warn( localDirs[i] + "is not writable\n", de);
}
} else {
LOG.warn( "Failed to create " + localDirs[i]);
}
} catch (IOException ie) {
LOG.warn( "Failed to create " + localDirs[i] + ": " +
ie.getMessage() + "\n" + StringUtils.stringifyException(ie));
ie.getMessage() + "\n", ie);
} //ignore
}
localDirs = dirs.toArray(new String[dirs.size()]);
@ -261,7 +260,7 @@ public class LocalDirAllocator {
DiskChecker.checkDir(new File(file.getParent().toUri().getPath()));
return file;
} catch (DiskErrorException d) {
LOG.warn(StringUtils.stringifyException(d));
LOG.warn("Disk Error Exception: ", d);
return null;
}
}

View File

@ -327,15 +327,13 @@ public class Trash extends Configured {
}
}
} catch (Exception e) {
LOG.warn("RuntimeException during Trash.Emptier.run() " +
StringUtils.stringifyException(e));
LOG.warn("RuntimeException during Trash.Emptier.run(): ", e);
}
}
try {
fs.close();
} catch(IOException e) {
LOG.warn("Trash cannot close FileSystem. " +
StringUtils.stringifyException(e));
LOG.warn("Trash cannot close FileSystem: ", e);
}
}

View File

@ -61,7 +61,7 @@ class RetryInvocationHandler implements InvocationHandler {
if (!policy.shouldRetry(e, retries++)) {
LOG.info("Exception while invoking " + method.getName()
+ " of " + implementation.getClass() + ". Not retrying."
+ StringUtils.stringifyException(e));
, e);
if (!method.getReturnType().equals(Void.TYPE)) {
throw e; // non-void methods can't fail without an exception
}
@ -70,7 +70,7 @@ class RetryInvocationHandler implements InvocationHandler {
if(LOG.isDebugEnabled()) {
LOG.debug("Exception while invoking " + method.getName()
+ " of " + implementation.getClass() + ". Retrying."
+ StringUtils.stringifyException(e));
, e);
}
}
}

View File

@ -71,8 +71,7 @@ public class SerializationFactory extends Configured {
serializations.add((Serialization)
ReflectionUtils.newInstance(serializionClass, getConf()));
} catch (ClassNotFoundException e) {
LOG.warn("Serialization class not found: " +
StringUtils.stringifyException(e));
LOG.warn("Serialization class not found: ", e);
}
}

View File

@ -1501,7 +1501,7 @@ public abstract class Server {
);
}
} catch (Throwable e) {
LOG.info(getName()+", call "+call+": error: " + e, e);
LOG.info(getName() + ", call: " + call + ", error: ", e);
errorClass = e.getClass().getName();
error = StringUtils.stringifyException(e);
// Remove redundant error class name from the beginning of the stack trace

View File

@ -97,8 +97,7 @@ public class MetricsIntValue extends MetricsBase {
try {
mr.setMetric(getName(), value);
} catch (Exception e) {
LOG.info("pushMetric failed for " + getName() + "\n" +
StringUtils.stringifyException(e));
LOG.info("pushMetric failed for " + getName() + "\n", e);
}
}
changed = false;

View File

@ -106,8 +106,7 @@ public class MetricsTimeVaryingInt extends MetricsBase {
try {
mr.incrMetric(getName(), getPreviousIntervalValue());
} catch (Exception e) {
LOG.info("pushMetric failed for " + getName() + "\n" +
StringUtils.stringifyException(e));
LOG.info("pushMetric failed for " + getName() + "\n" , e);
}
}

View File

@ -102,8 +102,7 @@ public class MetricsTimeVaryingLong extends MetricsBase{
try {
mr.incrMetric(getName(), getPreviousIntervalValue());
} catch (Exception e) {
LOG.info("pushMetric failed for " + getName() + "\n" +
StringUtils.stringifyException(e));
LOG.info("pushMetric failed for " + getName() + "\n" , e);
}
}

View File

@ -150,8 +150,7 @@ public class MetricsTimeVaryingRate extends MetricsBase {
mr.incrMetric(getName() + "_num_ops", getPreviousIntervalNumOps());
mr.setMetric(getName() + "_avg_time", getPreviousIntervalAverageTime());
} catch (Exception e) {
LOG.info("pushMetric failed for " + getName() + "\n" +
StringUtils.stringifyException(e));
LOG.info("pushMetric failed for " + getName() + "\n" , e);
}
}

View File

@ -156,7 +156,7 @@ implements Configurable
s.execute();
allOutput.append(s.getOutput() + " ");
} catch (Exception e) {
LOG.warn(StringUtils.stringifyException(e));
LOG.warn("Exception: ", e);
return null;
}
loopCount++;

View File

@ -288,8 +288,7 @@ abstract class SocketIOWithTimeout {
try {
selector.close();
} catch (IOException e) {
LOG.warn("Unexpected exception while closing selector : " +
StringUtils.stringifyException(e));
LOG.warn("Unexpected exception while closing selector : ", e);
}
}
}
@ -361,8 +360,7 @@ abstract class SocketIOWithTimeout {
try {
info.selector.selectNow();
} catch (IOException e) {
LOG.info("Unexpected Exception while clearing selector : " +
StringUtils.stringifyException(e));
LOG.info("Unexpected Exception while clearing selector : ", e);
// don't put the selector back.
info.close();
return ret;

View File

@ -373,8 +373,7 @@ extends AbstractDelegationTokenIdentifier>
rollMasterKey();
lastMasterKeyUpdate = now;
} catch (IOException e) {
LOG.error("Master key updating failed. "
+ StringUtils.stringifyException(e));
LOG.error("Master key updating failed: ", e);
}
}
if (lastTokenCacheCleanup + tokenRemoverScanInterval < now) {

View File

@ -164,7 +164,7 @@ public class TestDelegationToken {
action.run();
Assert.fail("action did not throw " + except);
} catch (Throwable th) {
LOG.info("Caught an exception: " + StringUtils.stringifyException(th));
LOG.info("Caught an exception: ", th);
assertEquals("action threw wrong exception", except, th.getClass());
}
}