mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
log: make log_set_upgrade_syslog_to_journal() take effect immediately
This doesn't matter much, and we don't rely on it, but I think it's much nicer if we log_set_target() and log_set_upgrade_syslog_to_journal() can be called in either order and have the same effect.
This commit is contained in:
parent
ab93297cd0
commit
6fdb8de42f
@ -1314,6 +1314,14 @@ int log_syntax_invalid_utf8_internal(
|
||||
|
||||
void log_set_upgrade_syslog_to_journal(bool b) {
|
||||
upgrade_syslog_to_journal = b;
|
||||
|
||||
/* Make the change effective immediately */
|
||||
if (b) {
|
||||
if (log_target == LOG_TARGET_SYSLOG)
|
||||
log_target = LOG_TARGET_JOURNAL;
|
||||
else if (log_target == LOG_TARGET_SYSLOG_OR_KMSG)
|
||||
log_target = LOG_TARGET_JOURNAL_OR_KMSG;
|
||||
}
|
||||
}
|
||||
|
||||
void log_set_always_reopen_console(bool b) {
|
||||
|
@ -302,6 +302,7 @@ LogTarget log_target_from_string(const char *s) _pure_;
|
||||
|
||||
void log_received_signal(int level, const struct signalfd_siginfo *si);
|
||||
|
||||
/* If turned on, any requests for a log target involving "syslog" will be implicitly upgraded to the equivalent journal target */
|
||||
void log_set_upgrade_syslog_to_journal(bool b);
|
||||
void log_set_always_reopen_console(bool b);
|
||||
void log_set_open_when_needed(bool b);
|
||||
|
@ -2328,6 +2328,7 @@ int main(int argc, char *argv[]) {
|
||||
saved_argv = argv;
|
||||
saved_argc = argc;
|
||||
|
||||
/* Make sure that if the user says "syslog" we actually log to the journal. */
|
||||
log_set_upgrade_syslog_to_journal(true);
|
||||
|
||||
if (getpid_cached() == 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user