Procházet zdrojové kódy

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/branches/branch-0.22@1205699 13f79535-47bb-0310-9956-ffa450edef68
Konstantin Shvachko před 13 roky
rodič
revize
6f5490cb19

+ 3 - 0
common/CHANGES.txt

@@ -268,6 +268,9 @@ Release 0.22.0 - Unreleased
 
     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
 
     HADOOP-6884. Add LOG.isDebugEnabled() guard for each LOG.debug(..).

+ 10 - 1
common/src/java/org/apache/hadoop/ipc/Server.java

@@ -1487,7 +1487,16 @@ public abstract class Server {
                   );
             }
           } catch (Throwable e) {
-            LOG.info(getName()+", call "+call+": error: " + e, 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();
             error = StringUtils.stringifyException(e);
             // Remove redundant error class name from the beginning of the stack trace