From fc83909c3f697e725790874a1773707a8ff6b2b4 Mon Sep 17 00:00:00 2001 From: Christopher Douglas Date: Sat, 13 Feb 2010 12:21:26 +0000 Subject: [PATCH] HADOOP-6548. Replace mortbay imports with commons logging. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@909802 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ src/java/org/apache/hadoop/fs/FileUtil.java | 11 ++++++++--- .../hadoop/io/compress/zlib/BuiltInZlibDeflater.java | 10 +++++++--- .../hadoop/io/compress/zlib/ZlibCompressor.java | 9 +++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index c7e38a2f25f..d42bd21c00c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -189,6 +189,8 @@ Trunk (unreleased changes) HADOOP-6505. Use tr rather than sed to effect literal substitution in the build script. (Allen Wittenauer via cdouglas) + HADOOP-6548. Replace mortbay imports with commons logging. (cdouglas) + Release 0.21.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/src/java/org/apache/hadoop/fs/FileUtil.java b/src/java/org/apache/hadoop/fs/FileUtil.java index 736579ef6aa..c4952564e32 100644 --- a/src/java/org/apache/hadoop/fs/FileUtil.java +++ b/src/java/org/apache/hadoop/fs/FileUtil.java @@ -27,12 +27,17 @@ import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.util.Shell; import org.apache.hadoop.util.Shell.ShellCommandExecutor; -import org.mortbay.log.Log; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * A collection of file-processing util methods */ public class FileUtil { + + private static final Log LOG = LogFactory.getLog(FileUtil.class); + /** * convert an array of FileStatus to an array of Path * @@ -752,8 +757,8 @@ public class FileUtil { try { shExec.execute(); }catch(Exception e) { - if(Log.isDebugEnabled()) { - Log.debug("Error while changing permission : " + filename + if(LOG.isDebugEnabled()) { + LOG.debug("Error while changing permission : " + filename +" Exception: " + StringUtils.stringifyException(e)); } } diff --git a/src/java/org/apache/hadoop/io/compress/zlib/BuiltInZlibDeflater.java b/src/java/org/apache/hadoop/io/compress/zlib/BuiltInZlibDeflater.java index a017e1bc9aa..9fe8ca6623f 100644 --- a/src/java/org/apache/hadoop/io/compress/zlib/BuiltInZlibDeflater.java +++ b/src/java/org/apache/hadoop/io/compress/zlib/BuiltInZlibDeflater.java @@ -23,7 +23,9 @@ import java.util.zip.Deflater; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.compress.Compressor; -import org.mortbay.log.Log; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * A wrapper around java.util.zip.Deflater to make it conform @@ -32,6 +34,8 @@ import org.mortbay.log.Log; */ public class BuiltInZlibDeflater extends Deflater implements Compressor { + private static final Log LOG = LogFactory.getLog(BuiltInZlibDeflater.class); + public BuiltInZlibDeflater(int level, boolean nowrap) { super(level, nowrap); } @@ -69,9 +73,9 @@ public class BuiltInZlibDeflater extends Deflater implements Compressor { try { setStrategy(strategy.compressionStrategy()); } catch (IllegalArgumentException ill) { - Log.warn(strategy + " not supported by BuiltInZlibDeflater."); + LOG.warn(strategy + " not supported by BuiltInZlibDeflater."); setStrategy(DEFAULT_STRATEGY); } - Log.debug("Reinit compressor with new compression configuration"); + LOG.debug("Reinit compressor with new compression configuration"); } } diff --git a/src/java/org/apache/hadoop/io/compress/zlib/ZlibCompressor.java b/src/java/org/apache/hadoop/io/compress/zlib/ZlibCompressor.java index 25491495e79..739de5f3da9 100644 --- a/src/java/org/apache/hadoop/io/compress/zlib/ZlibCompressor.java +++ b/src/java/org/apache/hadoop/io/compress/zlib/ZlibCompressor.java @@ -25,7 +25,9 @@ import java.nio.ByteBuffer; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.compress.Compressor; import org.apache.hadoop.util.NativeCodeLoader; -import org.mortbay.log.Log; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * A {@link Compressor} based on the popular @@ -34,6 +36,9 @@ import org.mortbay.log.Log; * */ public class ZlibCompressor implements Compressor { + + private static final Log LOG = LogFactory.getLog(ZlibCompressor.class); + private static final int DEFAULT_DIRECT_BUFFER_SIZE = 64*1024; // HACK - Use this as a global lock in the JNI layer @@ -248,7 +253,7 @@ public class ZlibCompressor implements Compressor { stream = init(level.compressionLevel(), strategy.compressionStrategy(), windowBits.windowBits()); - Log.debug("Reinit compressor with new compression configuration"); + LOG.debug("Reinit compressor with new compression configuration"); } public synchronized void setInput(byte[] b, int off, int len) {