kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From granthe...@apache.org
Subject [2/3] kudu git commit: [java] Adjust the RetryRule to log to stdout
Date Wed, 05 Sep 2018 01:30:11 GMT
[java] Adjust the RetryRule to log to stdout

Changes the logging in RetryRule to use slf4j and
write to stdout. This makes serializing the logs and
failures more straightforward.

Additionally the stacktrace for each failure is printed
with the log message. This way, even if a retry passes,
we can see the reason for earlier failures.

Change-Id: I2608256d98c08f0ecfda52ea44289a0deca64fe0
Reviewed-on: http://gerrit.cloudera.org:8080/11382
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <adar@cloudera.com>
Reviewed-by: Andrew Wong <awong@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/459be18f
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/459be18f
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/459be18f

Branch: refs/heads/master
Commit: 459be18fab2d722eafd03e03c608d9f86a4eb990
Parents: dcc39d5
Author: Grant Henke <granthenke@apache.org>
Authored: Tue Sep 4 10:35:28 2018 -0500
Committer: Grant Henke <granthenke@apache.org>
Committed: Tue Sep 4 22:49:03 2018 +0000

----------------------------------------------------------------------
 .../src/test/java/org/apache/kudu/junit/RetryRule.java        | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/459be18f/java/kudu-client/src/test/java/org/apache/kudu/junit/RetryRule.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/junit/RetryRule.java b/java/kudu-client/src/test/java/org/apache/kudu/junit/RetryRule.java
index 89bd84f..716fcab 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/junit/RetryRule.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/junit/RetryRule.java
@@ -19,6 +19,8 @@ package org.apache.kudu.junit;
 import org.junit.rules.TestRule;
 import org.junit.runner.Description;
 import org.junit.runners.model.Statement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * A JUnit rule to retry failed tests.
@@ -28,6 +30,7 @@ import org.junit.runners.model.Statement;
  */
 public class RetryRule implements TestRule {
 
+  private static final Logger LOG = LoggerFactory.getLogger(RetryRule.class);
   private static final int RETRY_COUNT = Integer.getInteger("rerunFailingTestsCount", 0);
 
   public RetryRule () {}
@@ -66,10 +69,10 @@ public class RetryRule implements TestRule {
           return;
         } catch (Throwable t) {
           lastException = t;
-          System.err.println(description.getDisplayName() + ": run " + (i + 1) + " failed.");
+          LOG.error(description.getDisplayName() + ": failed run " + (i + 1), t);
         }
       }
-      System.err.println(description.getDisplayName() + ": giving up after " + retryCount
+ " failures.");
+      LOG.error(description.getDisplayName() + ": giving up after " + retryCount + " failures");
       throw lastException;
     }
   }


Mime
View raw message