Blob Blame History Raw
From 720ddd02100ab8592e081aed425c9455b397a462 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Thu, 25 Nov 2021 14:36:10 +0100
Subject: [PATCH] syslog: avoid duplicate log messages

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2024248
---
 service/realm-diagnostics.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/service/realm-diagnostics.c b/service/realm-diagnostics.c
index 850b2e3..6aa5288 100644
--- a/service/realm-diagnostics.c
+++ b/service/realm-diagnostics.c
@@ -55,12 +55,20 @@ log_syslog_and_debug (GDBusMethodInvocation *invocation,
 	while ((ptr = memchr (at, '\n', length)) != NULL) {
 		*ptr = '\0';
 		if (line_buffer && line_buffer->len > 0) {
+#ifdef WITH_JOURNAL
+			/* Call realm_daemon_syslog directly to add
+			 * REALMD_OPERATION to the jounrnal */
 			realm_daemon_syslog (operation, log_level, "%s%s", line_buffer->str, at);
+#else
 			g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s%s", line_buffer->str, at);
+#endif
 			g_string_set_size (line_buffer, 0);
 		} else {
+#ifdef WITH_JOURNAL
 			realm_daemon_syslog (operation, log_level, "%s", at);
+#else
 			g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s", at);
+#endif
 		}
 
 		*ptr = '\n';
-- 
2.34.1