X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=support%2Fgeneral%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fio%2FSimpleProcess.java;h=c08f001da84910d26e8b74a2be72968f78503a26;hb=e72743b6a9fac5a99b842f92b1687fba65ef3210;hp=5e18b16cb7a97c7375fb4b0842e962f3a4c74680;hpb=8e8ee09c167988d6368715a0ad60dfbb59d5fc96;p=utils diff --git a/support/general/src/main/java/org/wamblee/io/SimpleProcess.java b/support/general/src/main/java/org/wamblee/io/SimpleProcess.java index 5e18b16c..c08f001d 100644 --- a/support/general/src/main/java/org/wamblee/io/SimpleProcess.java +++ b/support/general/src/main/java/org/wamblee/io/SimpleProcess.java @@ -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); } } }