diff options
author | Simon Rettberg | 2016-12-01 15:16:35 +0100 |
---|---|---|
committer | Simon Rettberg | 2016-12-01 15:16:35 +0100 |
commit | a9c0ef8b10b87765e545cd03bca67eddfc456b0a (patch) | |
tree | c66aae82ea7364eec3db39a90012c5290e4fe915 | |
parent | Add cancellable tasks, optional response payload compression (diff) | |
download | taskman-lite-a9c0ef8b10b87765e545cd03bca67eddfc456b0a.tar.gz taskman-lite-a9c0ef8b10b87765e545cd03bca67eddfc456b0a.tar.xz taskman-lite-a9c0ef8b10b87765e545cd03bca67eddfc456b0a.zip |
Better error logging: Include exception in some logger calls
-rw-r--r-- | api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java | 9 | ||||
-rw-r--r-- | daemon/src/main/java/org/openslx/taskmanager/network/NetworkHandler.java | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java b/api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java index 7b67c12..2f3cf57 100644 --- a/api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java +++ b/api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java @@ -5,6 +5,7 @@ import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; +import java.util.Arrays; import org.apache.log4j.Logger; @@ -37,6 +38,12 @@ public abstract class SystemCommandTask extends AbstractTask if ( command == null || command.length == 0 ) { return processEnded( -1 ); } + for (String a : command) { + if (a == null) { + log.warn( "An argument from initCommandLine is null: " + Arrays.toString( command ) ); + return processEnded( -5 ); + } + } ProcessBuilder pb = new ProcessBuilder( command ); pb.directory( new File( "/" ) ); @@ -47,7 +54,7 @@ public abstract class SystemCommandTask extends AbstractTask try { process = pb.start(); } catch ( Exception e ) { - log.warn( "Process of task " + getId() + " died." ); + log.warn( "Process of task " + getId() + " died.", e ); processStdErrInternal( e.toString() ); return processEnded( -2 ); } diff --git a/daemon/src/main/java/org/openslx/taskmanager/network/NetworkHandler.java b/daemon/src/main/java/org/openslx/taskmanager/network/NetworkHandler.java index 08a1d61..6946cd1 100644 --- a/daemon/src/main/java/org/openslx/taskmanager/network/NetworkHandler.java +++ b/daemon/src/main/java/org/openslx/taskmanager/network/NetworkHandler.java @@ -144,7 +144,7 @@ public class NetworkHandler implements Runnable try { socket.send( packet ); } catch ( IOException e ) { - log.debug( "Could not send UDP packet to " + packet.getAddress().getHostAddress().toString() ); + log.debug( "Could not send UDP packet to " + packet.getAddress().getHostAddress().toString(), e ); } } } catch ( InterruptedException e ) { |