Browse Source

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
Christopher Douglas 15 years ago
parent
commit
fc83909c3f

+ 2 - 0
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

+ 8 - 3
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));
       }
     }

+ 7 - 3
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");
   }
 }

+ 7 - 2
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) {