HADOOP-7358. Improve log levels when exceptions caught in RPC handler. Contributed by Todd Lipcon.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1205697 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Konstantin Shvachko 2011-11-24 01:52:29 +00:00
parent f17ed541c7
commit e3c6965519
2 changed files with 13 additions and 1 deletions

View File

@ -1096,6 +1096,9 @@ Release 0.22.0 - Unreleased
HADOOP-7786. Remove HDFS-specific config keys defined in FsConfig. (eli) HADOOP-7786. Remove HDFS-specific config keys defined in FsConfig. (eli)
HADOOP-7358. Improve log levels when exceptions caught in RPC handler
(Todd Lipcon via shv)
OPTIMIZATIONS OPTIMIZATIONS
HADOOP-6884. Add LOG.isDebugEnabled() guard for each LOG.debug(..). HADOOP-6884. Add LOG.isDebugEnabled() guard for each LOG.debug(..).

View File

@ -1536,7 +1536,16 @@ public Writable run() throws Exception {
); );
} }
} catch (Throwable e) { } catch (Throwable e) {
LOG.info(getName() + ", call: " + call + ", error: ", e); String logMsg = getName() + ", call " + call + ": error: " + e;
if (e instanceof RuntimeException || e instanceof Error) {
// These exception types indicate something is probably wrong
// on the server side, as opposed to just a normal exceptional
// result.
LOG.warn(logMsg, e);
} else {
LOG.info(logMsg, e);
}
errorClass = e.getClass().getName(); errorClass = e.getClass().getName();
error = StringUtils.stringifyException(e); error = StringUtils.stringifyException(e);
// Remove redundant error class name from the beginning of the stack trace // Remove redundant error class name from the beginning of the stack trace