You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2023/01/04 03:26:35 UTC

[hbase] branch branch-2 updated: HBASE-27485 HBaseTestingUtility minicluster requires log4j2 (#4941)

This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 2fdefdc2734 HBASE-27485 HBaseTestingUtility minicluster requires log4j2 (#4941)
2fdefdc2734 is described below

commit 2fdefdc273482e4f70fbd7d7eec39894c9e3d253
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Wed Jan 4 11:06:47 2023 +0800

    HBASE-27485 HBaseTestingUtility minicluster requires log4j2 (#4941)
    
    Signed-off-by: Rajeshbabu Chintaguntla <ra...@apache.org>
    Reviewed-by: SiCheng-Zheng <64...@qq.com>
    (cherry picked from commit 3f1087fe822fee51719bb407eee851a33a2d94a2)
---
 hbase-logging/src/test/resources/log4j2.properties           | 10 ++++++++--
 .../java/org/apache/hadoop/hbase/HBaseTestingUtility.java    | 12 ------------
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/hbase-logging/src/test/resources/log4j2.properties b/hbase-logging/src/test/resources/log4j2.properties
index 67c5670effe..56d67c85aa1 100644
--- a/hbase-logging/src/test/resources/log4j2.properties
+++ b/hbase-logging/src/test/resources/log4j2.properties
@@ -46,11 +46,13 @@ logger.MetricsConfig.level = WARN
 logger.MetricsSinkAdapter.name = org.apache.hadoop.metrics2.impl.MetricsSinkAdapter
 logger.MetricsSinkAdapter.level = WARN
 
+# These two settings are workarounds against spurious logs from the minicluster.
+# See HBASE-4709
 logger.MetricsSystemImpl.name = org.apache.hadoop.metrics2.impl.MetricsSystemImpl
-logger.MetricsSystemImpl.level = WARN
+logger.MetricsSystemImpl.level = ERROR
 
 logger.MBeans.name = org.apache.hadoop.metrics2.util.MBeans
-logger.MBeans.level = WARN
+logger.MBeans.level = ERROR
 
 logger.directory.name = org.apache.directory
 logger.directory.level = WARN
@@ -68,3 +70,7 @@ logger.RSRpcServices.level = DEBUG
 
 logger.TestJul2Slf4j.name = org.apache.hadoop.hbase.logging.TestJul2Slf4j
 logger.TestJul2Slf4j.level = DEBUG
+
+# Avoid log flooded with chore execution time, see HBASE-24646 for more details.
+logger.ScheduledChore.name = org.apache.hadoop.hbase.ScheduledChore
+logger.ScheduledChore.level = INFO
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
index 97111082afb..37b7f0ddc5f 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
@@ -681,11 +681,6 @@ public class HBaseTestingUtility extends HBaseZKTestingUtility {
     createDirsAndSetProperties();
     EditLogFileOutputStream.setShouldSkipFsyncForTesting(true);
 
-    // Error level to skip some warnings specific to the minicluster. See HBASE-4709
-    Log4jUtils.setLogLevel(org.apache.hadoop.metrics2.util.MBeans.class.getName(), "ERROR");
-    Log4jUtils.setLogLevel(org.apache.hadoop.metrics2.impl.MetricsSystemImpl.class.getName(),
-      "ERROR");
-
     this.dfsCluster =
       new MiniDFSCluster(0, this.conf, servers, true, true, true, null, racks, hosts, null);
     this.dfsClusterFixer = new FsDatasetAsyncDiskServiceFixer(dfsCluster);
@@ -707,10 +702,6 @@ public class HBaseTestingUtility extends HBaseZKTestingUtility {
 
   public MiniDFSCluster startMiniDFSClusterForTestWAL(int namenodePort) throws IOException {
     createDirsAndSetProperties();
-    // Error level to skip some warnings specific to the minicluster. See HBASE-4709
-    Log4jUtils.setLogLevel(org.apache.hadoop.metrics2.util.MBeans.class.getName(), "ERROR");
-    Log4jUtils.setLogLevel(org.apache.hadoop.metrics2.impl.MetricsSystemImpl.class.getName(),
-      "ERROR");
     dfsCluster =
       new MiniDFSCluster(namenodePort, conf, 5, false, true, true, null, null, null, null);
     this.dfsClusterFixer = new FsDatasetAsyncDiskServiceFixer(dfsCluster);
@@ -1183,9 +1174,6 @@ public class HBaseTestingUtility extends HBaseZKTestingUtility {
       conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MAXTOSTART, option.getNumRegionServers());
     }
 
-    // Avoid log flooded with chore execution time, see HBASE-24646 for more details.
-    Log4jUtils.setLogLevel(org.apache.hadoop.hbase.ScheduledChore.class.getName(), "INFO");
-
     Configuration c = new Configuration(this.conf);
     this.hbaseCluster = new MiniHBaseCluster(c, option.getNumMasters(),
       option.getNumAlwaysStandByMasters(), option.getNumRegionServers(), option.getRsPorts(),