kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danburk...@apache.org
Subject incubator-kudu git commit: Reduce verbosity of Java logs
Date Thu, 26 May 2016 17:02:50 GMT
Repository: incubator-kudu
Updated Branches:
  refs/heads/master 3ab902eb3 -> eff3a590d


Reduce verbosity of Java logs

This commit changes the logging format in order to make it more compact. Date
and originating class have been removed from log lines, however the time,
originating filename, and line remain. The minicluster has been changed to use
the relative binary name plus port as the thread name instead of the full path
to the binary (e.g. kudu-master:7051 instead of
/home/dan/kudu/build/debug/bin/kudu-master). The result is that a typical log
line originating from the mini cluster has been reduced from 349 to 214 columns.

Change-Id: Ibf26651908f533859f16cb4293a06157f9577c7d
Reviewed-on: http://gerrit.cloudera.org:8080/3203
Reviewed-by: Jean-Daniel Cryans
Tested-by: Kudu Jenkins


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

Branch: refs/heads/master
Commit: eff3a590d2854e544a8353b0dd2756b1b3e37309
Parents: 3ab902e
Author: Dan Burkert <dan@cloudera.com>
Authored: Tue May 24 14:45:50 2016 -0700
Committer: Dan Burkert <dan@cloudera.com>
Committed: Thu May 26 17:01:00 2016 +0000

----------------------------------------------------------------------
 .../java/org/kududb/client/MiniKuduCluster.java     | 16 +++++++---------
 .../kudu-client/src/test/resources/log4j.properties |  2 +-
 java/kudu-spark/src/test/resources/log4j.properties |  2 +-
 3 files changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/eff3a590/java/kudu-client/src/test/java/org/kududb/client/MiniKuduCluster.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/kududb/client/MiniKuduCluster.java b/java/kudu-client/src/test/java/org/kududb/client/MiniKuduCluster.java
index d11ee88..7ddced4 100644
--- a/java/kudu-client/src/test/java/org/kududb/client/MiniKuduCluster.java
+++ b/java/kudu-client/src/test/java/org/kududb/client/MiniKuduCluster.java
@@ -16,7 +16,9 @@ package org.kududb.client;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Joiner;
 import com.google.common.base.Preconditions;
+import com.google.common.base.Splitter;
 import com.google.common.base.Stopwatch;
+import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import com.google.common.net.HostAndPort;
 import org.apache.commons.io.FileUtils;
@@ -224,10 +226,10 @@ public class MiniKuduCluster implements AutoCloseable {
     processBuilder.redirectErrorStream(true);
     Process proc = processBuilder.start();
     ProcessInputStreamLogPrinterRunnable printer =
-        new ProcessInputStreamLogPrinterRunnable(port, proc.getInputStream());
+        new ProcessInputStreamLogPrinterRunnable(proc.getInputStream());
     Thread thread = new Thread(printer);
     thread.setDaemon(true);
-    thread.setName(command[0]);
+    thread.setName(Iterables.getLast(Splitter.on(File.separatorChar).split(command[0])) +
":" + port);
     PROCESS_INPUT_PRINTERS.add(thread);
     thread.start();
 
@@ -245,7 +247,6 @@ public class MiniKuduCluster implements AutoCloseable {
   /**
    * Starts a previously killed master process on the specified port.
    * @param port which port the master was listening on for RPCs
-   * @return true if it was successful, false otherwise
    * @throws Exception
    */
   public void restartDeadMasterOnPort(int port) throws Exception {
@@ -255,7 +256,6 @@ public class MiniKuduCluster implements AutoCloseable {
   /**
    * Starts a previously killed tablet server process on the specified port.
    * @param port which port the TS was listening on for RPCs
-   * @return true if it was successful, false otherwise
    * @throws Exception
    */
   public void restartDeadTabletServerOnPort(int port) throws Exception {
@@ -388,14 +388,12 @@ public class MiniKuduCluster implements AutoCloseable {
   /**
    * Helper runnable that receives stdout and logs it along with the process' identifier.
    */
-  static class ProcessInputStreamLogPrinterRunnable implements Runnable {
+  private static class ProcessInputStreamLogPrinterRunnable implements Runnable {
 
     private final InputStream is;
-    private final int port;
 
-    public ProcessInputStreamLogPrinterRunnable(int port, InputStream is) {
+    public ProcessInputStreamLogPrinterRunnable(InputStream is) {
       this.is = is;
-      this.port = port;
     }
 
     @Override
@@ -404,7 +402,7 @@ public class MiniKuduCluster implements AutoCloseable {
         String line;
         BufferedReader in = new BufferedReader(new InputStreamReader(is));
         while ((line = in.readLine()) != null) {
-          LOG.info("{}: {}", port, line);
+          LOG.info(line);
         }
         in.close();
       }

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/eff3a590/java/kudu-client/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/resources/log4j.properties b/java/kudu-client/src/test/resources/log4j.properties
index b1ce4ed..79573b8 100644
--- a/java/kudu-client/src/test/resources/log4j.properties
+++ b/java/kudu-client/src/test/resources/log4j.properties
@@ -19,4 +19,4 @@ log4j.rootLogger = DEBUG, out
 
 log4j.appender.out = org.apache.log4j.ConsoleAppender
 log4j.appender.out.layout = org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern = %d (%t) [%p - %l] %m%n
+log4j.appender.out.layout.ConversionPattern = %d{HH:mm:ss.SSS} [%p - %t] (%F:%L) %m%n

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/eff3a590/java/kudu-spark/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/java/kudu-spark/src/test/resources/log4j.properties b/java/kudu-spark/src/test/resources/log4j.properties
index 94321ff..4c1b502 100644
--- a/java/kudu-spark/src/test/resources/log4j.properties
+++ b/java/kudu-spark/src/test/resources/log4j.properties
@@ -18,6 +18,6 @@
 log4j.rootLogger = WARN, out
 log4j.appender.out = org.apache.log4j.ConsoleAppender
 log4j.appender.out.layout = org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern = %d (%t) [%p - %l] %m%n
+log4j.appender.out.layout.ConversionPattern = %d{HH:mm:ss.SSS} [%p - %t] (%F:%L) %m%n
 
 log4j.logger.org.kududb = INFO
\ No newline at end of file


Mime
View raw message