Skip to content

Commit 3f1087f

Browse files
authored
HBASE-27485 HBaseTestingUtility minicluster requires log4j2 (apache#4941)
Signed-off-by: Rajeshbabu Chintaguntla <[email protected]> Reviewed-by: SiCheng-Zheng <[email protected]>
1 parent c8eb196 commit 3f1087f

File tree

3 files changed

+8
-26
lines changed

3 files changed

+8
-26
lines changed

hbase-logging/src/test/resources/log4j2.properties

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ logger.MetricsConfig.level = WARN
4646
logger.MetricsSinkAdapter.name = org.apache.hadoop.metrics2.impl.MetricsSinkAdapter
4747
logger.MetricsSinkAdapter.level = WARN
4848

49+
# These two settings are workarounds against spurious logs from the minicluster.
50+
# See HBASE-4709
4951
logger.MetricsSystemImpl.name = org.apache.hadoop.metrics2.impl.MetricsSystemImpl
50-
logger.MetricsSystemImpl.level = WARN
52+
logger.MetricsSystemImpl.level = ERROR
5153

5254
logger.MBeans.name = org.apache.hadoop.metrics2.util.MBeans
53-
logger.MBeans.level = WARN
55+
logger.MBeans.level = ERROR
5456

5557
logger.directory.name = org.apache.directory
5658
logger.directory.level = WARN
@@ -68,3 +70,7 @@ logger.RSRpcServices.level = DEBUG
6870

6971
logger.TestJul2Slf4j.name = org.apache.hadoop.hbase.logging.TestJul2Slf4j
7072
logger.TestJul2Slf4j.level = DEBUG
73+
74+
# Avoid log flooded with chore execution time, see HBASE-24646 for more details.
75+
logger.ScheduledChore.name = org.apache.hadoop.hbase.ScheduledChore
76+
logger.ScheduledChore.level = INFO

hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtil.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
import org.apache.hadoop.hbase.io.hfile.ChecksumUtil;
9797
import org.apache.hadoop.hbase.io.hfile.HFile;
9898
import org.apache.hadoop.hbase.ipc.RpcServerInterface;
99-
import org.apache.hadoop.hbase.logging.Log4jUtils;
10099
import org.apache.hadoop.hbase.mapreduce.MapreduceTestingShim;
101100
import org.apache.hadoop.hbase.master.HMaster;
102101
import org.apache.hadoop.hbase.master.RegionState;
@@ -631,10 +630,6 @@ public MiniDFSCluster startMiniDFSCluster(int servers, final String[] racks, Str
631630
createDirsAndSetProperties();
632631
EditLogFileOutputStream.setShouldSkipFsyncForTesting(true);
633632

634-
// Error level to skip some warnings specific to the minicluster. See HBASE-4709
635-
Log4jUtils.setLogLevel(org.apache.hadoop.metrics2.util.MBeans.class.getName(), "ERROR");
636-
Log4jUtils.setLogLevel(org.apache.hadoop.metrics2.impl.MetricsSystemImpl.class.getName(),
637-
"ERROR");
638633
this.dfsCluster =
639634
new MiniDFSCluster(0, this.conf, servers, true, true, true, null, racks, hosts, null);
640635
this.dfsClusterFixer = new FsDatasetAsyncDiskServiceFixer(dfsCluster);
@@ -656,10 +651,6 @@ public MiniDFSCluster startMiniDFSCluster(int servers, final String[] racks, Str
656651

657652
public MiniDFSCluster startMiniDFSClusterForTestWAL(int namenodePort) throws IOException {
658653
createDirsAndSetProperties();
659-
// Error level to skip some warnings specific to the minicluster. See HBASE-4709
660-
Log4jUtils.setLogLevel(org.apache.hadoop.metrics2.util.MBeans.class.getName(), "ERROR");
661-
Log4jUtils.setLogLevel(org.apache.hadoop.metrics2.impl.MetricsSystemImpl.class.getName(),
662-
"ERROR");
663654
dfsCluster =
664655
new MiniDFSCluster(namenodePort, conf, 5, false, true, true, null, null, null, null);
665656
this.dfsClusterFixer = new FsDatasetAsyncDiskServiceFixer(dfsCluster);
@@ -884,9 +875,6 @@ public SingleProcessHBaseCluster startMiniHBaseCluster(StartTestingClusterOption
884875
conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MAXTOSTART, option.getNumRegionServers());
885876
}
886877

887-
// Avoid log flooded with chore execution time, see HBASE-24646 for more details.
888-
Log4jUtils.setLogLevel(org.apache.hadoop.hbase.ScheduledChore.class.getName(), "INFO");
889-
890878
Configuration c = new Configuration(this.conf);
891879
this.hbaseCluster = new SingleProcessHBaseCluster(c, option.getNumMasters(),
892880
option.getNumAlwaysStandByMasters(), option.getNumRegionServers(), option.getRsPorts(),

hbase-testing-util/src/main/java/org/apache/hadoop/hbase/HBaseTestingUtility.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -616,11 +616,6 @@ public MiniDFSCluster startMiniDFSCluster(int servers, final String racks[], Str
616616
createDirsAndSetProperties();
617617
EditLogFileOutputStream.setShouldSkipFsyncForTesting(true);
618618

619-
// Error level to skip some warnings specific to the minicluster. See HBASE-4709
620-
Log4jUtils.setLogLevel(org.apache.hadoop.metrics2.util.MBeans.class.getName(), "ERROR");
621-
Log4jUtils.setLogLevel(org.apache.hadoop.metrics2.impl.MetricsSystemImpl.class.getName(),
622-
"ERROR");
623-
624619
this.dfsCluster =
625620
new MiniDFSCluster(0, this.conf, servers, true, true, true, null, racks, hosts, null);
626621
this.dfsClusterFixer = new FsDatasetAsyncDiskServiceFixer(dfsCluster);
@@ -642,10 +637,6 @@ public MiniDFSCluster startMiniDFSCluster(int servers, final String racks[], Str
642637

643638
public MiniDFSCluster startMiniDFSClusterForTestWAL(int namenodePort) throws IOException {
644639
createDirsAndSetProperties();
645-
// Error level to skip some warnings specific to the minicluster. See HBASE-4709
646-
Log4jUtils.setLogLevel(org.apache.hadoop.metrics2.util.MBeans.class.getName(), "ERROR");
647-
Log4jUtils.setLogLevel(org.apache.hadoop.metrics2.impl.MetricsSystemImpl.class.getName(),
648-
"ERROR");
649640
dfsCluster =
650641
new MiniDFSCluster(namenodePort, conf, 5, false, true, true, null, null, null, null);
651642
this.dfsClusterFixer = new FsDatasetAsyncDiskServiceFixer(dfsCluster);
@@ -1118,9 +1109,6 @@ public MiniHBaseCluster startMiniHBaseCluster(StartMiniClusterOption option)
11181109
conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MAXTOSTART, option.getNumRegionServers());
11191110
}
11201111

1121-
// Avoid log flooded with chore execution time, see HBASE-24646 for more details.
1122-
Log4jUtils.setLogLevel(org.apache.hadoop.hbase.ScheduledChore.class.getName(), "INFO");
1123-
11241112
Configuration c = new Configuration(this.conf);
11251113
this.hbaseCluster = new MiniHBaseCluster(c, option.getNumMasters(),
11261114
option.getNumAlwaysStandByMasters(), option.getNumRegionServers(), option.getRsPorts(),

0 commit comments

Comments
 (0)