From f85fba4a547baefe4ec6d8466edec754d7b19458 Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Fri, 7 Sep 2018 15:09:09 -0700 Subject: [PATCH] HBASE-20307 LoadTestTool prints too much zookeeper logging (Colin Garcia) --- .../org/apache/hadoop/hbase/util/LoadTestTool.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java index 41788588ff1..f4f483e847f 100644 --- a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java +++ b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java @@ -36,7 +36,10 @@ import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder; +import org.apache.log4j.Level; +import org.apache.log4j.LogManager; import org.apache.yetus.audience.InterfaceAudience; +import org.apache.zookeeper.ZooKeeper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.hadoop.hbase.client.Admin; @@ -113,6 +116,8 @@ public class LoadTestTool extends AbstractHBaseTool { protected static final String OPT_USAGE_COMPRESSION = "Compression type, " + "one of " + Arrays.toString(Compression.Algorithm.values()); + protected static final String OPT_VERBOSE = "verbose"; + public static final String OPT_BLOOM = "bloom"; public static final String OPT_COMPRESSION = "compression"; public static final String OPT_DEFERRED_LOG_FLUSH = "deferredlogflush"; @@ -186,7 +191,7 @@ public class LoadTestTool extends AbstractHBaseTool { protected long startKey, endKey; - protected boolean isWrite, isRead, isUpdate; + protected boolean isVerbose, isWrite, isRead, isUpdate; protected boolean deferredLogFlush; // Column family options @@ -314,6 +319,7 @@ public class LoadTestTool extends AbstractHBaseTool { @Override protected void addOptions() { + addOptNoArg("v", OPT_VERBOSE, "Will display a full readout of logs, including ZooKeeper"); addOptWithArg(OPT_ZK_QUORUM, "ZK quorum as comma-separated host names " + "without port numbers"); addOptWithArg(OPT_ZK_PARENT_NODE, "name of parent znode in zookeeper"); @@ -416,6 +422,7 @@ public class LoadTestTool extends AbstractHBaseTool { families = HFileTestUtil.DEFAULT_COLUMN_FAMILIES; } + isVerbose = cmd.hasOption(OPT_VERBOSE); isWrite = cmd.hasOption(OPT_WRITE); isRead = cmd.hasOption(OPT_READ); isUpdate = cmd.hasOption(OPT_UPDATE); @@ -565,6 +572,9 @@ public class LoadTestTool extends AbstractHBaseTool { @Override protected int doWork() throws IOException { + if (!isVerbose) { + LogManager.getLogger(ZooKeeper.class.getName()).setLevel(Level.WARN); + } if (numTables > 1) { return parallelLoadTables(); } else {