diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedLock.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedLock.java index 0520271c9b..2c1f591a1f 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedLock.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedLock.java @@ -25,9 +25,9 @@ import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; -import org.apache.commons.logging.Log; import com.google.common.annotations.VisibleForTesting; +import org.slf4j.Logger; /** * This is a debugging class that can be used by callers to track @@ -44,7 +44,7 @@ public class InstrumentedLock implements Lock { private final Lock lock; - private final Log logger; + private final Logger logger; private final String name; private final Timer clock; @@ -70,20 +70,20 @@ public class InstrumentedLock implements Lock { * @param lockWarningThresholdMs the time threshold to view lock held * time as being "too long" */ - public InstrumentedLock(String name, Log logger, long minLoggingGapMs, - long lockWarningThresholdMs) { + public InstrumentedLock(String name, Logger logger, long minLoggingGapMs, + long lockWarningThresholdMs) { this(name, logger, new ReentrantLock(), minLoggingGapMs, lockWarningThresholdMs); } - public InstrumentedLock(String name, Log logger, Lock lock, + public InstrumentedLock(String name, Logger logger, Lock lock, long minLoggingGapMs, long lockWarningThresholdMs) { this(name, logger, lock, minLoggingGapMs, lockWarningThresholdMs, new Timer()); } @VisibleForTesting - InstrumentedLock(String name, Log logger, Lock lock, + InstrumentedLock(String name, Logger logger, Lock lock, long minLoggingGapMs, long lockWarningThresholdMs, Timer clock) { this.name = name; this.lock = lock; diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedReadLock.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedReadLock.java index 09fd43ec69..e115718478 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedReadLock.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedReadLock.java @@ -19,11 +19,11 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; -import org.apache.commons.logging.Log; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import com.google.common.annotations.VisibleForTesting; +import org.slf4j.Logger; /** * This is a wrap class of a ReadLock. @@ -51,7 +51,7 @@ protected Long initialValue() { }; }; - public InstrumentedReadLock(String name, Log logger, + public InstrumentedReadLock(String name, Logger logger, ReentrantReadWriteLock readWriteLock, long minLoggingGapMs, long lockWarningThresholdMs) { this(name, logger, readWriteLock, minLoggingGapMs, lockWarningThresholdMs, @@ -59,7 +59,7 @@ public InstrumentedReadLock(String name, Log logger, } @VisibleForTesting - InstrumentedReadLock(String name, Log logger, + InstrumentedReadLock(String name, Logger logger, ReentrantReadWriteLock readWriteLock, long minLoggingGapMs, long lockWarningThresholdMs, Timer clock) { super(name, logger, readWriteLock.readLock(), minLoggingGapMs, diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedReadWriteLock.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedReadWriteLock.java index 62e6b09981..a410524076 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedReadWriteLock.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedReadWriteLock.java @@ -21,9 +21,9 @@ import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import org.apache.commons.logging.Log; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; +import org.slf4j.Logger; /** * This is a wrap class of a {@link ReentrantReadWriteLock}. @@ -37,7 +37,7 @@ public class InstrumentedReadWriteLock implements ReadWriteLock { private final Lock readLock; private final Lock writeLock; - InstrumentedReadWriteLock(boolean fair, String name, Log logger, + InstrumentedReadWriteLock(boolean fair, String name, Logger logger, long minLoggingGapMs, long lockWarningThresholdMs) { ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock(fair); readLock = new InstrumentedReadLock(name, logger, readWriteLock, diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedWriteLock.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedWriteLock.java index 9208c1b356..6842166930 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedWriteLock.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/InstrumentedWriteLock.java @@ -19,11 +19,11 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; -import org.apache.commons.logging.Log; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import com.google.common.annotations.VisibleForTesting; +import org.slf4j.Logger; /** * This is a wrap class of a WriteLock. @@ -37,7 +37,7 @@ @InterfaceStability.Unstable public class InstrumentedWriteLock extends InstrumentedLock { - public InstrumentedWriteLock(String name, Log logger, + public InstrumentedWriteLock(String name, Logger logger, ReentrantReadWriteLock readWriteLock, long minLoggingGapMs, long lockWarningThresholdMs) { this(name, logger, readWriteLock, minLoggingGapMs, lockWarningThresholdMs, @@ -45,7 +45,7 @@ public InstrumentedWriteLock(String name, Log logger, } @VisibleForTesting - InstrumentedWriteLock(String name, Log logger, + InstrumentedWriteLock(String name, Logger logger, ReentrantReadWriteLock readWriteLock, long minLoggingGapMs, long lockWarningThresholdMs, Timer clock) { super(name, logger, readWriteLock.writeLock(), minLoggingGapMs, diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestInstrumentedLock.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestInstrumentedLock.java index d3f69122d6..44158ec5b0 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestInstrumentedLock.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestInstrumentedLock.java @@ -21,8 +21,8 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.Lock; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; @@ -34,7 +34,7 @@ */ public class TestInstrumentedLock { - static final Log LOG = LogFactory.getLog(TestInstrumentedLock.class); + static final Logger LOG = LoggerFactory.getLogger(TestInstrumentedLock.class); @Rule public TestName name = new TestName(); diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestInstrumentedReadWriteLock.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestInstrumentedReadWriteLock.java index eeefa88073..3e1a88bd0a 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestInstrumentedReadWriteLock.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestInstrumentedReadWriteLock.java @@ -24,18 +24,19 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.ReentrantReadWriteLock; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A test class for InstrumentedReadLock and InstrumentedWriteLock. */ public class TestInstrumentedReadWriteLock { - static final Log LOG = LogFactory.getLog(TestInstrumentedReadWriteLock.class); + static final Logger LOG = LoggerFactory.getLogger( + TestInstrumentedReadWriteLock.class); @Rule public TestName name = new TestName(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java index c17ef36627..6b1ee3d5c3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java @@ -740,7 +740,8 @@ private long validateIntegrityAndSetLength(File blockFile, long genStamp) { } } } catch (IOException e) { - FsDatasetImpl.LOG.warn(e); + FsDatasetImpl.LOG.warn("Getting exception while validating integrity " + + "and setting length for blockFile", e); return 0; } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java index 11835a53fb..1e159cd49d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java @@ -46,8 +46,6 @@ import javax.management.StandardMBean; import com.google.common.annotations.VisibleForTesting; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.CommonConfigurationKeys; @@ -119,6 +117,8 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.common.collect.Sets; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /************************************************** * FSDataset manages a set of data blocks. Each block @@ -127,7 +127,7 @@ ***************************************************/ @InterfaceAudience.Private class FsDatasetImpl implements FsDatasetSpi { - static final Log LOG = LogFactory.getLog(FsDatasetImpl.class); + static final Logger LOG = LoggerFactory.getLogger(FsDatasetImpl.class); private final static boolean isNativeIOAvailable; private Timer timer; static {