diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index b17492d5cd..1844357016 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1208,6 +1208,9 @@ Release 2.8.0 - UNRELEASED HDFS-8930. Block report lease may leak if the 2nd full block report comes when NN is still in safemode (Colin P. McCabe via Jing Zhao) + HDFS-8948. Use GenericTestUtils to set log levels in TestPread and + TestReplaceDatanodeOnFailure. (Mingliang Liu via wheat9) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestPread.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestPread.java index ed553f6667..43650a84b4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestPread.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestPread.java @@ -29,7 +29,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.apache.commons.logging.impl.Log4JLogger; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.ChecksumException; import org.apache.hadoop.fs.FSDataInputStream; @@ -41,6 +40,7 @@ import org.apache.hadoop.hdfs.protocol.datatransfer.DataTransferProtocol; import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset; import org.apache.hadoop.io.IOUtils; +import org.apache.hadoop.test.GenericTestUtils; import org.apache.log4j.Level; import org.junit.Before; import org.junit.Test; @@ -261,7 +261,7 @@ public void testPreadDFS() throws IOException { @Test public void testPreadDFSNoChecksum() throws IOException { Configuration conf = new Configuration(); - ((Log4JLogger)DataTransferProtocol.LOG).getLogger().setLevel(Level.ALL); + GenericTestUtils.setLogLevel(DataTransferProtocol.LOG, Level.ALL); dfsPreadTest(conf, false, false); dfsPreadTest(conf, true, false); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestReplaceDatanodeOnFailure.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestReplaceDatanodeOnFailure.java index f92f287e28..d3510203eb 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestReplaceDatanodeOnFailure.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestReplaceDatanodeOnFailure.java @@ -21,7 +21,6 @@ import java.util.Arrays; import org.apache.commons.logging.Log; -import org.apache.commons.logging.impl.Log4JLogger; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataOutputStream; @@ -33,6 +32,7 @@ import org.apache.hadoop.hdfs.protocol.datatransfer.ReplaceDatanodeOnFailure; import org.apache.hadoop.hdfs.protocol.datatransfer.ReplaceDatanodeOnFailure.Policy; import org.apache.hadoop.io.IOUtils; +import org.apache.hadoop.test.GenericTestUtils; import org.apache.log4j.Level; import org.junit.Assert; import org.junit.Test; @@ -49,7 +49,7 @@ public class TestReplaceDatanodeOnFailure { final private static String RACK1 = "/rack1"; { - ((Log4JLogger)DataTransferProtocol.LOG).getLogger().setLevel(Level.ALL); + GenericTestUtils.setLogLevel(DataTransferProtocol.LOG, Level.ALL); } /** Test DEFAULT ReplaceDatanodeOnFailure policy. */