summaryrefslogtreecommitdiff
path: root/src/shared/log.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-08-11 20:08:08 +0200
committerLennart Poettering <lennart@poettering.net>2014-08-11 20:08:08 +0200
commitc1dc6153c9426d98ddbcd8b5077f397f18ff1da7 (patch)
tree6bb0a7586c9f8877666676128ba2ff087118b59f /src/shared/log.c
parent79c1afc67f973eaece8f1b7016e016bb33c256a7 (diff)
log: never ever log to syslog from PID 1, log to the journal again
We don't support journal-less systems anyway, so let's avoid the confusion.
Diffstat (limited to 'src/shared/log.c')
-rw-r--r--src/shared/log.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shared/log.c b/src/shared/log.c
index 078ccdc35b..2bac998bcd 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -51,6 +51,8 @@ static bool syslog_is_stream = false;
static bool show_color = false;
static bool show_location = false;
+static bool upgrade_syslog_to_journal = false;
+
/* Akin to glibc's __abort_msg; which is private and we hence cannot
* use here. */
static char *log_abort_msg = NULL;
@@ -267,6 +269,13 @@ void log_set_target(LogTarget target) {
assert(target >= 0);
assert(target < _LOG_TARGET_MAX);
+ if (upgrade_syslog_to_journal) {
+ if (target == LOG_TARGET_SYSLOG)
+ target = LOG_TARGET_JOURNAL;
+ else if (target == LOG_TARGET_SYSLOG_OR_KMSG)
+ target = LOG_TARGET_JOURNAL_OR_KMSG;
+ }
+
log_target = target;
}
@@ -984,3 +993,7 @@ void log_received_signal(int level, const struct signalfd_siginfo *si) {
signal_to_string(si->ssi_signo));
}
+
+void log_set_upgrade_syslog_to_journal(bool b) {
+ upgrade_syslog_to_journal = b;
+}