[gnome-session] main: If we have systemd, initialize journal here



commit ec5ca6da156c232b44a8ab16c7a1a2e8d81a6f82
Author: Colin Walters <walters verbum org>
Date:   Mon May 6 16:17:47 2013 -0400

    main: If we have systemd, initialize journal here
    
    If gdm has been configured with the systemd journal, then the normal
    output has "/etc/X11/gdm/Xsession" as the program name.  That's fugly.
    As a purely cosmetic thing, let's reinitialize the journal here with
    "gnome-session" as the program name.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699785

 gnome-session/main.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/gnome-session/main.c b/gnome-session/main.c
index b6ee6ce..8f7cb4b 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -48,6 +48,10 @@
 #include "gsm-system.h"
 #include "gsm-fail-whale.h"
 
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-journal.h>
+#endif
+
 #define GSM_DBUS_NAME "org.gnome.SessionManager"
 
 static gboolean failsafe = FALSE;
@@ -292,6 +296,18 @@ main (int argc, char **argv)
                 gsm_util_init_error (TRUE, "%s", error->message);
         }
 
+#ifdef HAVE_SYSTEMD
+        {
+                int journalfd;
+
+                journalfd = sd_journal_stream_fd (PACKAGE, LOG_INFO, 0);
+                if (journalfd >= 0) {
+                        dup2(journalfd, 1);
+                        dup2(journalfd, 2);
+                }
+        }
+#endif
+
         /* Check GL, if it doesn't work out then force software fallback */
         if (!check_gl (&error)) {
                 gl_failed = TRUE;


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