accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject git commit: ACCUMULO-2514 switch over to log4j where it makes sense
Date Thu, 12 Jun 2014 23:34:18 GMT
Repository: accumulo
Updated Branches:
  refs/heads/1.5.2-SNAPSHOT c5aac49ed -> 67bc847d7


ACCUMULO-2514 switch over to log4j where it makes sense


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/67bc847d
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/67bc847d
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/67bc847d

Branch: refs/heads/1.5.2-SNAPSHOT
Commit: 67bc847d7c56807447ba32a4599e0a339bd5f7a3
Parents: c5aac49
Author: Eric Newton <eric.newton@gmail.com>
Authored: Thu Jun 12 19:22:51 2014 -0400
Committer: Eric Newton <eric.newton@gmail.com>
Committed: Thu Jun 12 19:22:51 2014 -0400

----------------------------------------------------------------------
 .../test/continuous/ContinuousVerify.java        |  4 +++-
 .../accumulo/test/continuous/Histogram.java      |  8 +++-----
 .../test/continuous/PrintScanTimeHistogram.java  | 19 +++++++++++--------
 3 files changed, 17 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/67bc847d/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java
b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java
index 70156b2..ebeee8a 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java
@@ -44,6 +44,7 @@ import org.apache.hadoop.mapreduce.Reducer;
 import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
 import org.apache.hadoop.util.Tool;
 import org.apache.hadoop.util.ToolRunner;
+import org.apache.log4j.Logger;
 
 import com.beust.jcommander.Parameter;
 import com.beust.jcommander.validators.PositiveInteger;
@@ -57,6 +58,7 @@ public class ContinuousVerify extends Configured implements Tool {
 
   public static class CMapper extends Mapper<Key,Value,LongWritable,VLongWritable>
{
 
+    private static final Logger log = Logger.getLogger(CMapper.class);
     private LongWritable row = new LongWritable();
     private LongWritable ref = new LongWritable();
     private VLongWritable vrow = new VLongWritable();
@@ -74,7 +76,7 @@ public class ContinuousVerify extends Configured implements Tool {
       } catch (BadChecksumException bce) {
         CounterUtils.increment(context.getCounter(Counts.CORRUPT));
         if (corrupt < 1000) {
-          System.out.println("ERROR Bad checksum : " + key);
+          log.error("Bad checksum : " + key);
         } else if (corrupt == 1000) {
           System.out.println("Too many bad checksums, not printing anymore!");
         }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/67bc847d/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java b/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java
index f1657b7..8475e6c 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java
@@ -119,7 +119,7 @@ public class Histogram<T> implements Serializable {
     return sortedKeys;
   }
   
-  public void print() {
+  public void print(StringBuilder out) {
     TreeSet<HistData<T>> sortedCounts = new TreeSet<HistData<T>>(counts.values());
     
     int maxValueLen = 0;
@@ -138,11 +138,9 @@ public class Histogram<T> implements Serializable {
       
       psum += getPercentage(hd.bin);
       
-      System.out.printf(" %" + (maxValueLen + 1) + "s %,16d %6.2f%s %6.2f%s%n", hd.bin +
"", hd.count, getPercentage(hd.bin), "%", psum, "%");
+      out.append(String.format(" %" + (maxValueLen + 1) + "s %,16d %6.2f%s %6.2f%s%n", hd.bin
+ "", hd.count, getPercentage(hd.bin), "%", psum, "%"));
     }
-    
-    System.out.println();
-    System.out.printf(" %" + (maxValueLen + 1) + "s %,16d %n", "TOTAL", sum);
+    out.append(String.format("%n %" + (maxValueLen + 1) + "s %,16d %n", "TOTAL", sum));
   }
   
   public void save(String file) throws IOException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/67bc847d/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java
b/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java
index fc5262b..683f2a0 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java
@@ -23,24 +23,27 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 
 import org.apache.accumulo.core.Constants;
+import org.apache.log4j.Logger;
 
 public class PrintScanTimeHistogram {
   
+  private static final Logger log = Logger.getLogger(PrintScanTimeHistogram.class);
+
   public static void main(String[] args) throws Exception {
     Histogram<String> srqHist = new Histogram<String>();
     Histogram<String> fsrHist = new Histogram<String>();
     
     processFile(System.in, srqHist, fsrHist);
     
-    System.out.println();
-    System.out.println(" *** Single row queries histogram *** ");
-    System.out.println();
-    srqHist.print();
+    StringBuilder report = new StringBuilder();
+    report.append(String.format("%n *** Single row queries histogram *** %n"));
+    srqHist.print(report);
+    log.info(report);
     
-    System.out.println();
-    System.out.println(" *** Find start rows histogram *** ");
-    System.out.println();
-    fsrHist.print();
+    report = new StringBuilder();
+    report.append(String.format("%n *** Find start rows histogram *** %n"));
+    fsrHist.print(report);
+    log.info(report);
   }
   
   private static void processFile(InputStream ins, Histogram<String> srqHist, Histogram<String>
fsrHist) throws FileNotFoundException, IOException {


Mime
View raw message