|
|
bc0354 |
From 720ddd02100ab8592e081aed425c9455b397a462 Mon Sep 17 00:00:00 2001
|
|
|
bc0354 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
bc0354 |
Date: Thu, 25 Nov 2021 14:36:10 +0100
|
|
|
bc0354 |
Subject: [PATCH] syslog: avoid duplicate log messages
|
|
|
bc0354 |
|
|
|
bc0354 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2024248
|
|
|
bc0354 |
---
|
|
|
bc0354 |
service/realm-diagnostics.c | 8 ++++++++
|
|
|
bc0354 |
1 file changed, 8 insertions(+)
|
|
|
bc0354 |
|
|
|
bc0354 |
diff --git a/service/realm-diagnostics.c b/service/realm-diagnostics.c
|
|
|
bc0354 |
index 850b2e3..6aa5288 100644
|
|
|
bc0354 |
--- a/service/realm-diagnostics.c
|
|
|
bc0354 |
+++ b/service/realm-diagnostics.c
|
|
|
bc0354 |
@@ -55,12 +55,20 @@ log_syslog_and_debug (GDBusMethodInvocation *invocation,
|
|
|
bc0354 |
while ((ptr = memchr (at, '\n', length)) != NULL) {
|
|
|
bc0354 |
*ptr = '\0';
|
|
|
bc0354 |
if (line_buffer && line_buffer->len > 0) {
|
|
|
bc0354 |
+#ifdef WITH_JOURNAL
|
|
|
bc0354 |
+ /* Call realm_daemon_syslog directly to add
|
|
|
bc0354 |
+ * REALMD_OPERATION to the jounrnal */
|
|
|
bc0354 |
realm_daemon_syslog (operation, log_level, "%s%s", line_buffer->str, at);
|
|
|
bc0354 |
+#else
|
|
|
bc0354 |
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s%s", line_buffer->str, at);
|
|
|
bc0354 |
+#endif
|
|
|
bc0354 |
g_string_set_size (line_buffer, 0);
|
|
|
bc0354 |
} else {
|
|
|
bc0354 |
+#ifdef WITH_JOURNAL
|
|
|
bc0354 |
realm_daemon_syslog (operation, log_level, "%s", at);
|
|
|
bc0354 |
+#else
|
|
|
bc0354 |
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s", at);
|
|
|
bc0354 |
+#endif
|
|
|
bc0354 |
}
|
|
|
bc0354 |
|
|
|
bc0354 |
*ptr = '\n';
|
|
|
bc0354 |
--
|
|
|
bc0354 |
2.34.1
|
|
|
bc0354 |
|