File gnome-session-logging-to-systemd-journal-configurable.patch of Package gnome-session

From e7675cc3c3c078aedf57e6d386f10c47eb22f0d1 Mon Sep 17 00:00:00 2001
From: Felix Zhang <fezhang@suse.com>
Date: Sun, 17 Jul 2016 17:27:06 +0800
Subject: [PATCH] logging to systemd journal configurable

---
 configure.ac                      | 19 +++++++++++++++++++
 gnome-session/gsm-autostart-app.c |  6 ++++--
 gnome-session/gsm-manager.c       |  8 ++++----
 gnome-session/main.c              |  4 ++--
 4 files changed, 29 insertions(+), 8 deletions(-)

Index: gnome-session-3.26.0/configure.ac
===================================================================
--- gnome-session-3.26.0.orig/configure.ac	2017-09-12 16:06:00.000000000 +0200
+++ gnome-session-3.26.0/configure.ac	2017-09-22 13:53:17.805764740 +0200
@@ -148,6 +148,25 @@
 AM_CONDITIONAL(HAVE_SYSTEMD, [test "$enable_systemd" = "yes"], [Using systemd])
 
 dnl ====================================================================
+dnl systemd journal support
+dnl ====================================================================
+AC_ARG_ENABLE([systemd-journal],
+              AS_HELP_STRING([--enable-systemd-journal], [Send output to systemd journal]),
+              [enable_systemd_journal=$enableval],
+              [enable_systemd_journal=$enable_systemd])
+
+AC_MSG_CHECKING([whether to send the outputs of gnome-session and its child processes to systemd journal])
+
+AC_MSG_RESULT($enable_systemd_journal)
+
+if test x$enable_systemd_journal = xyes ; then
+        if test x$enable_systemd = xno ; then
+                AC_MSG_ERROR([Systemd not found, or it is not enabled])
+        fi
+        AC_DEFINE(ENABLE_SYSTEMD_JOURNAL, 1, [Define if output should be send to systemd journal])
+fi
+
+dnl ====================================================================
 dnl Check for ConsoleKit
 dnl ====================================================================
 
Index: gnome-session-3.26.0/gnome-session/gsm-autostart-app.c
===================================================================
--- gnome-session-3.26.0.orig/gnome-session/gsm-autostart-app.c	2017-05-30 18:57:54.000000000 +0200
+++ gnome-session-3.26.0/gnome-session/gsm-autostart-app.c	2017-09-22 13:53:17.805764740 +0200
@@ -33,7 +33,9 @@
 #endif
 
 #ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
 #include <systemd/sd-journal.h>
+#endif
 #include <systemd/sd-daemon.h>
 #endif
 
@@ -1027,7 +1029,7 @@
         app->priv->startup_id = sn_id;
 }
 
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
 static void
 on_child_setup (GsmAutostartApp *app)
 {
@@ -1098,7 +1100,7 @@
                 g_app_launch_context_setenv (ctx, "DESKTOP_AUTOSTART_ID", startup_id);
         }
 
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
         if (sd_booted () > 0) {
                 child_setup_func = (GSpawnChildSetupFunc) on_child_setup;
                 child_setup_data = app;
Index: gnome-session-3.26.0/gnome-session/gsm-manager.c
===================================================================
--- gnome-session-3.26.0.orig/gnome-session/gsm-manager.c	2017-07-19 17:07:22.000000000 +0200
+++ gnome-session-3.26.0/gnome-session/gsm-manager.c	2017-09-22 13:53:17.805764740 +0200
@@ -40,7 +40,7 @@
 #include "gsm-manager.h"
 #include "org.gnome.SessionManager.h"
 
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
 #include <systemd/sd-journal.h>
 #endif
 
@@ -271,7 +271,7 @@
                 allow_logout = !_log_out_is_locked_down (manager);
         }
 
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
         sd_journal_send ("MESSAGE_ID=%s", GSM_MANAGER_UNRECOVERABLE_FAILURE_MSGID,
                          "PRIORITY=%d", 3,
                          "MESSAGE=Unrecoverable failure in required component %s", app_id,
@@ -301,7 +301,7 @@
                 extensions = NULL;
         }
 
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
         sd_journal_send ("MESSAGE_ID=%s", GSM_MANAGER_UNRECOVERABLE_FAILURE_MSGID,
                          "PRIORITY=%d", 3,
                          "MESSAGE=Unrecoverable failure in required component %s", app_id,
@@ -1355,7 +1355,7 @@
                 do_phase_startup (manager);
                 break;
         case GSM_MANAGER_PHASE_RUNNING:
-#ifdef HAVE_SYSTEMD                
+#ifdef ENABLE_SYSTEMD_JOURNAL
                 sd_journal_send ("MESSAGE_ID=%s", GSM_MANAGER_STARTUP_SUCCEEDED_MSGID,
                                  "PRIORITY=%d", 5,
                                  "MESSAGE=Entering running state",
Index: gnome-session-3.26.0/gnome-session/main.c
===================================================================
--- gnome-session-3.26.0.orig/gnome-session/main.c	2017-06-29 16:24:18.000000000 +0200
+++ gnome-session-3.26.0/gnome-session/main.c	2017-09-22 13:53:17.805764740 +0200
@@ -41,7 +41,7 @@
 #include "gsm-system.h"
 #include "gsm-fail-whale.h"
 
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
 #include <systemd/sd-journal.h>
 #endif
 
@@ -329,7 +329,7 @@
          * journald picks ups the nicer "gnome-session" as the program
          * name instead of whatever shell script GDM happened to use.
          */
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
         if (!debug) {
                 int journalfd;
 
openSUSE Build Service is sponsored by