From a819d81d713c4b8cd2fc4a6dc50b6a69e150b939 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Thu, 2 Sep 2021 12:04:00 +0200 Subject: [qemu] Print output of VM viewer into debug log --- .../src/main/java/org/openslx/runvirt/viewer/ViewerUtils.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'core') 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. @@ -18,6 +19,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. *

@@ -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; } } -- cgit v1.2.3-55-g7522