(no commit message)
[utils] / support / general / src / main / java / org / wamblee / io / SimpleProcess.java
index 5e18b16cb7a97c7375fb4b0842e962f3a4c74680..c08f001da84910d26e8b74a2be72968f78503a26 100644 (file)
@@ -23,9 +23,8 @@ import java.io.InputStreamReader;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.util.Arrays;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
  * 
@@ -33,7 +32,7 @@ import org.apache.commons.logging.LogFactory;
  * @version $Revision$
  */
 public class SimpleProcess {
-    private static final Log LOG = LogFactory.getLog(SimpleProcess.class);
+    private static final Logger LOG = Logger.getLogger(SimpleProcess.class.getName());
 
     private File directory;
 
@@ -88,7 +87,7 @@ public class SimpleProcess {
                 fullcmd.append(" " + part);
             }
 
-            LOG.debug("Executing '" + fullcmd + "' in directory '" + directory +
+            LOG.fine("Executing '" + fullcmd + "' in directory '" + directory +
                 "'");
 
             java.lang.Process proc = Runtime.getRuntime().exec(cmd, null,
@@ -119,9 +118,9 @@ public class SimpleProcess {
             stderr = myStderr.toString();
 
             if (proc.exitValue() != 0) {
-                LOG.warn("Exit value was non-zero: " + this);
+                LOG.warning("Exit value was non-zero: " + this);
             } else {
-                LOG.debug("Process finished");
+                LOG.fine("Process finished");
             }
 
             return proc.exitValue();
@@ -138,8 +137,8 @@ public class SimpleProcess {
             aReaderThread.join();
         } catch (InterruptedException e) {
             LOG
-                .warn(this +
-                    ": error waiting for output stream reader of process to finish");
+                .log(Level.WARNING, this +
+                    ": error waiting for output stream reader of process to finish", e);
         }
     }
 
@@ -156,18 +155,18 @@ public class SimpleProcess {
                     String str;
 
                     while ((str = br.readLine()) != null) {
-                        LOG.debug(aPrefix + str);
+                        LOG.fine(aPrefix + str);
                         aOutput.write(str);
                     }
                 } catch (IOException e) {
-                    LOG.warn(SimpleProcess.this +
+                    LOG.log(Level.FINE, SimpleProcess.this +
                         ": error reading input stream", e);
                 } finally {
                     if (br != null) {
                         try {
                             br.close();
                         } catch (IOException e) {
-                            LOG.warn("Error closing stream " + aPrefix);
+                            LOG.log(Level.WARNING, "Error closing stream " + aPrefix, e);
                         }
                     }
                 }