You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by og...@apache.org on 2011/02/14 15:56:16 UTC

svn commit: r1070513 - in /incubator/stanbol/trunk/commons/testing/jarexec: pom.xml src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java

Author: ogrisel
Date: Mon Feb 14 14:56:15 2011
New Revision: 1070513

URL: http://svn.apache.org/viewvc?rev=1070513&view=rev
Log:
STANBOL-84: add some logs to better trace the problem

Modified:
    incubator/stanbol/trunk/commons/testing/jarexec/pom.xml
    incubator/stanbol/trunk/commons/testing/jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java

Modified: incubator/stanbol/trunk/commons/testing/jarexec/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/testing/jarexec/pom.xml?rev=1070513&r1=1070512&r2=1070513&view=diff
==============================================================================
--- incubator/stanbol/trunk/commons/testing/jarexec/pom.xml (original)
+++ incubator/stanbol/trunk/commons/testing/jarexec/pom.xml Mon Feb 14 14:56:15 2011
@@ -29,6 +29,11 @@
             <version>1.1</version>
             <scope>compile</scope>
         </dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-simple</artifactId>
+			<version>1.5.2</version>
+		</dependency>
     </dependencies>
     
     <build>

Modified: incubator/stanbol/trunk/commons/testing/jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/testing/jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java?rev=1070513&r1=1070512&r2=1070513&view=diff
==============================================================================
--- incubator/stanbol/trunk/commons/testing/jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java (original)
+++ incubator/stanbol/trunk/commons/testing/jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java Mon Feb 14 14:56:15 2011
@@ -29,6 +29,8 @@ import org.apache.commons.exec.Executor;
 import org.apache.commons.exec.PumpStreamHandler;
 import org.apache.commons.exec.ShutdownHookProcessDestroyer;
 import org.apache.commons.exec.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /** Start a runnable jar by forking a JVM process,
  *  and terminate the process when this VM exits.
@@ -38,6 +40,8 @@ public class JarExecutor {
     private final File jarToExecute;
     private final String javaExecutable;
     private final int serverPort;
+    
+    private final Logger log = LoggerFactory.getLogger(getClass());
 
     public static final int DEFAULT_PORT = 8765;
     public static final String DEFAULT_JAR_FOLDER = "target/dependency";
@@ -121,12 +125,12 @@ public class JarExecutor {
         final ExecuteResultHandler h = new ExecuteResultHandler() {
             @Override
             public void onProcessFailed(ExecuteException ex) {
-                info("Process execution failed:" + ex);
+                log.error("Process execution failed:" + ex, ex);
             }
 
             @Override
             public void onProcessComplete(int result) {
-                info("Process execution complete, exit code=" + result);
+                log.info("Process execution complete, exit code=" + result);
             }
         };
 
@@ -144,13 +148,10 @@ public class JarExecutor {
         cl.addArgument(jarToExecute.getAbsolutePath());
         cl.addArgument("-p");
         cl.addArgument(String.valueOf(serverPort));
-        info("Executing " + cl);
+        log.info("Executing " + cl);
         e.setStreamHandler(new PumpStreamHandler());
         e.setProcessDestroyer(new ShutdownHookProcessDestroyer());
         e.execute(cl, h);
     }
 
-    protected void info(String msg) {
-        System.out.println(getClass().getName() + ": " + msg);
-    }
 }