Skip to content

Commit

Permalink
HBASE-27485 HBaseTestingUtility minicluster requires log4j2 (#4941)
Browse files Browse the repository at this point in the history
Signed-off-by: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Reviewed-by: SiCheng-Zheng <643463623@qq.com>
  • Loading branch information
Apache9 authored Jan 4, 2023
1 parent c8eb196 commit 3f1087f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 26 deletions.
10 changes: 8 additions & 2 deletions hbase-logging/src/test/resources/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
import org.apache.hadoop.hbase.io.hfile.ChecksumUtil;
import org.apache.hadoop.hbase.io.hfile.HFile;
import org.apache.hadoop.hbase.ipc.RpcServerInterface;
import org.apache.hadoop.hbase.logging.Log4jUtils;
import org.apache.hadoop.hbase.mapreduce.MapreduceTestingShim;
import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.master.RegionState;
Expand Down Expand Up @@ -631,10 +630,6 @@ public MiniDFSCluster startMiniDFSCluster(int servers, final String[] racks, Str
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);
Expand All @@ -656,10 +651,6 @@ public MiniDFSCluster startMiniDFSCluster(int servers, final String[] racks, Str

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);
Expand Down Expand Up @@ -884,9 +875,6 @@ public SingleProcessHBaseCluster startMiniHBaseCluster(StartTestingClusterOption
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 SingleProcessHBaseCluster(c, option.getNumMasters(),
option.getNumAlwaysStandByMasters(), option.getNumRegionServers(), option.getRsPorts(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,11 +616,6 @@ public MiniDFSCluster startMiniDFSCluster(int servers, final String racks[], Str
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);
Expand All @@ -642,10 +637,6 @@ public MiniDFSCluster startMiniDFSCluster(int servers, final String racks[], Str

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);
Expand Down Expand Up @@ -1118,9 +1109,6 @@ public MiniHBaseCluster startMiniHBaseCluster(StartMiniClusterOption option)
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(),
Expand Down

0 comments on commit 3f1087f

Please sign in to comment.