diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-08-11 20:08:08 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-08-11 20:08:08 +0200 |
commit | c1dc6153c9426d98ddbcd8b5077f397f18ff1da7 (patch) | |
tree | 6bb0a7586c9f8877666676128ba2ff087118b59f /src/shared | |
parent | 79c1afc67f973eaece8f1b7016e016bb33c256a7 (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')
-rw-r--r-- | src/shared/log.c | 13 | ||||
-rw-r--r-- | src/shared/log.h | 2 |
2 files changed, 15 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; +} diff --git a/src/shared/log.h b/src/shared/log.h index 794af7be6a..9918381d39 100644 --- a/src/shared/log.h +++ b/src/shared/log.h @@ -172,3 +172,5 @@ LogTarget log_target_from_string(const char *s) _pure_; #define MESSAGE_ID(x) "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(x) void log_received_signal(int level, const struct signalfd_siginfo *si); + +void log_set_upgrade_syslog_to_journal(bool b); |