summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmed S. Darwish <darwish.07@gmail.com>2016-03-13 23:56:54 +0200
committerTanu Kaskinen <tanuk@iki.fi>2016-03-25 12:24:01 +0200
commit0f48b7c82378c32194b625d1fd886eee7f1e5928 (patch)
treebf709ea2dfcdf49914133bd0f34001192cdffc6c
parentd9c91f852e697c11c85c76a8d2fcbd79db2266f0 (diff)
downloadpulseaudio-0f48b7c82378c32194b625d1fd886eee7f1e5928.tar.gz
log: journal: Prevent duplicate values for CODE_* fields
sd_journal_send() implicitly add fields for the source file, function name and code line from where it's invoked. As code location fields CODE_FILE, CODE_LINE and CODE_FUNC are handled by PA's log module, we do not want the automatic values supplied by the sd_journal API. Without suppressing these, both the actual log event source and the call to sd_journal_send() will be logged: $ journalctl -b -f -o json-pretty [...] CODE_FILE : [ pulsecore/log.c, pulsecore/module.c ], CODE_LINE : [ 505, 181 ], MESSAGE : Failed to load module module-gconf CODE_FUNC : [ pa_log_levelv_meta, pa_module_load ], [...] (Commit log adapted from abrt libreport commit d1eaae97f0287f) Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
-rw-r--r--src/pulsecore/log.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c
index 3c876f695..b5db81871 100644
--- a/src/pulsecore/log.c
+++ b/src/pulsecore/log.c
@@ -39,6 +39,17 @@
#endif
#ifdef HAVE_SYSTEMD_JOURNAL
+
+/* sd_journal_send() implicitly add fields for the source file,
+ * function name and code line from where it's invoked. As the
+ * correct code location fields CODE_FILE, CODE_LINE and
+ * CODE_FUNC are already handled by this module, we do not want
+ * the automatic values supplied by the systemd journal API.
+ *
+ * Without suppressing these, both the actual log event source
+ * and the call to sd_journal_send() will be logged. */
+#define SD_JOURNAL_SUPPRESS_LOCATION
+
#include <systemd/sd-journal.h>
#endif