[gnome-session] Use sd_journal_send to log key events with MESSAGE_ID
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] Use sd_journal_send to log key events with MESSAGE_ID
- Date: Wed, 16 Jan 2013 15:36:25 +0000 (UTC)
commit 9ec4deede968ad55d18340109c5aa9f6416de13d
Author: Colin Walters <walters verbum org>
Date: Tue Jan 15 08:08:08 2013 -0500
Use sd_journal_send to log key events with MESSAGE_ID
The important part about this use of the journal is that we include
MESSAGE_ID, which allows the gnome-ostree test scripts (and others) to
look for these.
https://bugzilla.gnome.org/show_bug.cgi?id=691785
configure.ac | 2 +-
gnome-session/Makefile.am | 4 +++-
gnome-session/gsm-manager.c | 21 +++++++++++++++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e88e0cf..5f57bee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,7 +104,7 @@ AC_ARG_ENABLE([systemd],
[enable_systemd=auto])
PKG_CHECK_MODULES(SYSTEMD,
- [gio-unix-2.0 libsystemd-login >= 183 libsystemd-daemon],
+ [gio-unix-2.0 libsystemd-login >= 183 libsystemd-daemon libsystemd-journal],
[have_systemd=yes], [have_systemd=no])
AC_MSG_CHECKING([whether to use systemd])
diff --git a/gnome-session/Makefile.am b/gnome-session/Makefile.am
index cc884d2..814fa6d 100644
--- a/gnome-session/Makefile.am
+++ b/gnome-session/Makefile.am
@@ -1,3 +1,4 @@
+NULL =
bin_PROGRAMS = gnome-session
libexec_PROGRAMS = gnome-session-failed
noinst_LTLIBRARIES = libgsmutil.la
@@ -100,7 +101,8 @@ libgsmutil_la_CPPFLAGS = \
$(AM_CPPFLAGS)
libgsmutil_la_LIBADD = \
- $(GNOME_SESSION_LIBS)
+ $(GNOME_SESSION_LIBS) \
+ $(NULL)
gnome_session_failed_SOURCES = \
gsm-fail-whale-dialog.c \
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index 51ca383..1e12d20 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -46,6 +46,10 @@
#include "gsm-manager.h"
#include "gsm-manager-glue.h"
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-journal.h>
+#endif
+
#include "gsm-store.h"
#include "gsm-inhibitor.h"
#include "gsm-presence.h"
@@ -69,6 +73,10 @@
#define GSM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_MANAGER, GsmManagerPrivate))
+/* UUIDs for log messages */
+#define GSM_MANAGER_STARTUP_SUCCEEDED_MSGID "0ce153587afa4095832d233c17a88001"
+#define GSM_MANAGER_UNRECOVERABLE_FAILURE_MSGID "10dd2dc188b54a5e98970f56499d1f73"
+
#define GSM_MANAGER_DBUS_PATH "/org/gnome/SessionManager"
#define GSM_MANAGER_DBUS_NAME "org.gnome.SessionManager"
@@ -310,6 +318,13 @@ on_required_app_failure (GsmManager *manager,
allow_logout = !_log_out_is_locked_down (manager);
}
+#ifdef HAVE_SYSTEMD
+ sd_journal_send ("MESSAGE_ID=%s", GSM_MANAGER_UNRECOVERABLE_FAILURE_MSGID,
+ "PRIORITY=%d", 3,
+ "MESSAGE=Unrecoverable failure in required component %s", app_id,
+ NULL);
+#endif
+
gsm_fail_whale_dialog_we_failed (FALSE,
allow_logout,
extensions);
@@ -1529,6 +1544,12 @@ start_phase (GsmManager *manager)
do_phase_startup (manager);
break;
case GSM_MANAGER_PHASE_RUNNING:
+#ifdef HAVE_SYSTEMD
+ sd_journal_send ("MESSAGE_ID=%s", GSM_MANAGER_STARTUP_SUCCEEDED_MSGID,
+ "PRIORITY=%d", 5,
+ "MESSAGE=Entering running state",
+ NULL);
+#endif
g_signal_emit (manager, signals[SESSION_RUNNING], 0);
update_idle (manager);
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]