From eda559ffd2588a56f136c867b8ad3a6f1c56473c Mon Sep 17 00:00:00 2001 From: Xiaoyu Yao Date: Fri, 21 Jul 2017 14:19:26 -0700 Subject: [PATCH] HDFS-12181. Ozone: Fix TestContainerReplicationManager by setting proper log level for LogCapturer. Contributed by Mukul Kumar Singh. --- .../container/replication/ContainerReplicationManager.java | 2 +- .../replication/TestContainerReplicationManager.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/container/replication/ContainerReplicationManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/container/replication/ContainerReplicationManager.java index a22cd129210..ff71d004454 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/container/replication/ContainerReplicationManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/container/replication/ContainerReplicationManager.java @@ -64,7 +64,7 @@ import static org.apache.hadoop.scm.ScmConfigKeys * computes the replication levels for each container. */ public class ContainerReplicationManager implements Closeable { - static final Logger LOG = + public static final Logger LOG = LoggerFactory.getLogger(ContainerReplicationManager.class); private final NodePoolManager poolManager; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/replication/TestContainerReplicationManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/replication/TestContainerReplicationManager.java index cb88703c8b5..3f3aba9def8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/replication/TestContainerReplicationManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/replication/TestContainerReplicationManager.java @@ -35,7 +35,7 @@ import org.apache.hadoop.ozone.scm.node.NodeManager; import org.apache.hadoop.ozone.scm.node.NodePoolManager; import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.test.GenericTestUtils.LogCapturer; -import org.apache.log4j.Level; +import org.slf4j.event.Level; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -74,10 +74,12 @@ public class TestContainerReplicationManager { @After public void tearDown() throws Exception { logCapturer.stopCapturing(); + GenericTestUtils.setLogLevel(ContainerReplicationManager.LOG, Level.INFO); } @Before public void setUp() throws Exception { + GenericTestUtils.setLogLevel(ContainerReplicationManager.LOG, Level.DEBUG); Map nodeStateMap = new HashMap<>(); // We are setting up 3 pools with 24 nodes each in this cluster. // First we create 72 Datanodes. @@ -234,7 +236,7 @@ public class TestContainerReplicationManager { throws TimeoutException, InterruptedException, IOException { LogCapturer inProgressLog = LogCapturer.captureLogs( LogFactory.getLog(InProgressPool.class)); - GenericTestUtils.setLogLevel(InProgressPool.LOG, Level.ALL); + GenericTestUtils.setLogLevel(InProgressPool.LOG, Level.DEBUG); try { DatanodeID id = SCMTestUtils.getDatanodeID(); ((ReplicationNodeManagerMock) (nodeManager)).addNode(id, NodeManager