summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Bentele2021-09-02 12:04:00 +0200
committerManuel Bentele2021-09-02 12:04:00 +0200
commita819d81d713c4b8cd2fc4a6dc50b6a69e150b939 (patch)
tree7f03eb69b3e6e497d60ed2f834ccac73703dd60d
parent[qemu] Shutdown VM if VM viewer dies and VM remains running (diff)
downloadmltk-a819d81d713c4b8cd2fc4a6dc50b6a69e150b939.tar.gz
mltk-a819d81d713c4b8cd2fc4a6dc50b6a69e150b939.tar.xz
mltk-a819d81d713c4b8cd2fc4a6dc50b6a69e150b939.zip
[qemu] Print output of VM viewer into debug log
-rw-r--r--core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/viewer/ViewerUtils.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/viewer/ViewerUtils.java b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/viewer/ViewerUtils.java
index 1ed5947a..40c45671 100644
--- a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/viewer/ViewerUtils.java
+++ b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/viewer/ViewerUtils.java
@@ -9,6 +9,7 @@ import org.apache.commons.exec.PumpStreamHandler;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.log4j.Logger;
/**
* Utils for viewing displays of virtual machines.
@@ -19,6 +20,11 @@ import org.apache.commons.io.output.ByteArrayOutputStream;
public class ViewerUtils
{
/**
+ * Reference to the global logger for this class.
+ */
+ private static final Logger LOGGER = Logger.getLogger( ViewerUtils.class );
+
+ /**
* Synchronously executes a viewer program specified by a command line call.
* <p>
* The command line call of the viewer program consists of the program name and an optional list
@@ -57,9 +63,13 @@ public class ViewerUtils
throw new ViewerException( "Failed to execute '" + viewerProgram + "': " + e.getLocalizedMessage() );
}
+ // retrieve the content from the viewer's standard output
final String viewerOuput = viewerOutputStream.toString( StandardCharsets.UTF_8 );
IOUtils.closeQuietly( viewerOutputStream );
+ // log content from the viewer's standard output
+ ViewerUtils.LOGGER.debug( viewerOuput );
+
return viewerOuput;
}
}