Re: [spice-common v4 3/7] log: Use glib for logging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I realize I'm rather late to the party, but this change causes troubles
with Xspice.

That is, Xorg, on startup, closes stdout.

Since the g_log_default_handler writes to stdout for DEBUG and INFO
messages, those messages never show up anywhere.

The attached patch 'fixes' it.  I'm a bit hesitant to pursue this
approach; I do not know if using stdout will have a negative side effect
on the Xorg server.

Anyone else have insight?  I'll more formally submit this if I don't
hear anything back.

Cheers,

Jeremy
diff --git a/src/spiceqxl_spice_server.c b/src/spiceqxl_spice_server.c
index b2b31ff..f9ddba1 100644
--- a/src/spiceqxl_spice_server.c
+++ b/src/spiceqxl_spice_server.c
@@ -28,6 +28,8 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+#include <unistd.h>
+
 
 #include "qxl.h"
 #include "qxl_option_helpers.h"
@@ -39,6 +41,9 @@ SpiceServer *xspice_get_spice_server(void)
 {
     static SpiceServer *spice_server;
     if (!spice_server) {
+        /* Xorg closes stdout on us.  We reopen it to point at stderr, so that
+           g_log_default_handler will send it's output somewhere useful */
+        dup2(2, 1);
         spice_server = spice_server_new();
     }
     return spice_server;
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]