[gnome-session] Add a new switch to enable/disable forwarding to systemd journal
- From: Dominique Leuenberger <dleuen src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] Add a new switch to enable/disable forwarding to systemd journal
- Date: Thu, 4 Jan 2018 17:58:14 +0000 (UTC)
commit 099c19099de8e351f6cc0f2110ad27648780a0fe
Author: Dominique Leuenberger <dimstar opensuse org>
Date: Thu Jan 4 18:14:50 2018 +0100
Add a new switch to enable/disable forwarding to systemd journal
Allow distros that do wish to do so to disable logging to the systemd journal.
Unless specified at 'configure time', the default remains to log to the journal.
https://bugzilla.gnome.org/show_bug.cgi?id=768982
gnome-session/gsm-autostart-app.c | 6 ++++--
gnome-session/gsm-manager.c | 8 ++++----
gnome-session/main.c | 4 ++--
meson.build | 2 ++
meson_options.txt | 1 +
5 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/gnome-session/gsm-autostart-app.c b/gnome-session/gsm-autostart-app.c
index d946855..2332b03 100644
--- a/gnome-session/gsm-autostart-app.c
+++ b/gnome-session/gsm-autostart-app.c
@@ -29,7 +29,9 @@
#include <gio/gdesktopappinfo.h>
#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
#include <systemd/sd-journal.h>
+#endif
#include <systemd/sd-daemon.h>
#endif
@@ -941,7 +943,7 @@ app_launched (GAppLaunchContext *ctx,
app->priv->startup_id = sn_id;
}
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
static void
on_child_setup (GsmAutostartApp *app)
{
@@ -1012,7 +1014,7 @@ autostart_app_start_spawn (GsmAutostartApp *app,
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;
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index cd8bb2d..3cf421c 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -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 @@ on_required_app_failure (GsmManager *manager,
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 @@ on_display_server_failure (GsmManager *manager,
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 @@ start_phase (GsmManager *manager)
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",
diff --git a/gnome-session/main.c b/gnome-session/main.c
index dab5444..9a7f554 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -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
@@ -327,7 +327,7 @@ main (int argc, char **argv)
* 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;
diff --git a/meson.build b/meson.build
index ed6f1a8..e72a64e 100644
--- a/meson.build
+++ b/meson.build
@@ -118,6 +118,7 @@ enable_session_selector = get_option('session_selector')
session_tracking = 'null backend'
enable_systemd = get_option('systemd')
+enable_systemd_journal = get_option('systemd_journal')
enable_consolekit = get_option('consolekit')
if enable_systemd or enable_consolekit
session_bin_deps += dependency('gio-unix-2.0', version: glib_req_version)
@@ -159,6 +160,7 @@ if enable_systemd or enable_consolekit
endif
endif
config_h.set('HAVE_SYSTEMD', enable_systemd)
+config_h.set('HAVE_SYSTEMD_JOURNAL', enable_systemd_journal)
config_h.set('HAVE_CONSOLEKIT', enable_consolekit)
configure_file(
diff --git a/meson_options.txt b/meson_options.txt
index ed3059d..05174fe 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,6 +1,7 @@
option('deprecation_flags', type: 'boolean', value: false, description: 'use *_DISABLE_DEPRECATED flags')
option('session_selector', type: 'boolean', value: false, description: 'enable building a custom session
selector dialog')
option('systemd', type: 'boolean', value: true, description: 'Use systemd')
+option('systemd_journal', type: 'boolean', value:'true', description: 'Send log to systemd-journal')
option('consolekit', type: 'boolean', value: false, description: 'Use consolekit')
option('docbook', type: 'boolean', value: true, description: 'build documentation')
option('man', type: 'boolean', value: true, description: 'build documentation (requires xmlto)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]