HDFS-8948. Use GenericTestUtils to set log levels in TestPread and TestReplaceDatanodeOnFailure. Contributed by Mingliang Liu.

This commit is contained in:
Haohui Mai 2015-08-24 16:16:10 -07:00
parent bdd79388f3
commit 66d0c81d8f
3 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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. */