From 4cfa2c999dea269ddc646bfeba6c7f1021a73843 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 12 Jan 2012 05:09:06 +0100 Subject: [PATCH] core: switch all log targets to go directly to the journal, instead via syslog --- man/systemd.xml | 32 ++++++++++++--------------- src/bridge.c | 2 +- src/cgroups-agent.c | 2 +- src/cryptsetup/cryptsetup-generator.c | 2 +- src/getty-generator.c | 2 +- src/initctl.c | 2 +- src/login/user-sessions.c | 2 +- src/main.c | 6 ++--- src/manager.c | 12 +++++++--- src/manager.h | 2 +- src/modules-load.c | 2 +- src/quotacheck.c | 2 +- src/random-seed.c | 2 +- src/rc-local-generator.c | 2 +- src/readahead/readahead-collect.c | 2 +- src/readahead/readahead-replay.c | 2 +- src/remount-api-vfs.c | 2 +- src/reply-password.c | 2 +- src/shutdownd.c | 2 +- src/system.conf | 2 +- src/unit.c | 2 +- src/update-utmp.c | 2 +- units/fsck-root.service.in | 2 +- units/fsck@.service.in | 2 +- 24 files changed, 47 insertions(+), 45 deletions(-) diff --git a/man/systemd.xml b/man/systemd.xml index c1766e26..121cb212 100644 --- a/man/systemd.xml +++ b/man/systemd.xml @@ -209,8 +209,10 @@ Set log target. Argument must be one of , + , , , + , , . @@ -266,13 +268,15 @@ , , , + , + , , , , . If the argument is omitted - defaults to + defaults to and to @@ -823,19 +827,24 @@ + SIGRTMIN+26 SIGRTMIN+27 SIGRTMIN+28 SIGRTMIN+29 Sets the log level to - console - (resp. kmsg on + journal-or-kmsg + (resp. console on + SIGRTMIN+27; + resp. kmsg on SIGRTMIN+28; resp. syslog-or-kmsg on SIGRTMIN+29), as controlled via - systemd.log_target=console - (resp. systemd.log_target=kmsg + systemd.log_target=journal-or-kmsg + (resp. systemd.log_target=console + on SIGRTMIN+27; + resp. systemd.log_target=kmsg on SIGRTMIN+28; resp systemd.log_target=syslog-or-kmsg @@ -1078,19 +1087,6 @@ - - /run/systemd/stdout-syslog-bridge - - Used internally by the - systemd-stdout-syslog-bridge.service - unit to connect STDOUT and/or STDERR - of spawned processes to - syslog3 - or the kernel log buffer. This is an - AF_UNIX stream - socket. - - /run/systemd/shutdownd diff --git a/src/bridge.c b/src/bridge.c index 878856cf..1f7cf3a9 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -147,7 +147,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_JOURNAL_OR_KMSG); log_parse_environment(); log_open(); diff --git a/src/cgroups-agent.c b/src/cgroups-agent.c index 7f001e67..1bbc8827 100644 --- a/src/cgroups-agent.c +++ b/src/cgroups-agent.c @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) { goto finish; } - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c index a48b7a45..ba59b49b 100644 --- a/src/cryptsetup/cryptsetup-generator.c +++ b/src/cryptsetup/cryptsetup-generator.c @@ -245,7 +245,7 @@ int main(int argc, char *argv[]) { if (argc > 1) arg_dest = argv[1]; - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/src/getty-generator.c b/src/getty-generator.c index 6b5b254e..1263785f 100644 --- a/src/getty-generator.c +++ b/src/getty-generator.c @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/src/initctl.c b/src/initctl.c index e2189e9e..53d03a9e 100644 --- a/src/initctl.c +++ b/src/initctl.c @@ -388,7 +388,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/src/login/user-sessions.c b/src/login/user-sessions.c index df46b76c..64aa3bb1 100644 --- a/src/login/user-sessions.c +++ b/src/login/user-sessions.c @@ -35,7 +35,7 @@ int main(int argc, char*argv[]) { return EXIT_FAILURE; } - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/src/main.c b/src/main.c index b23dd18f..91516dad 100644 --- a/src/main.c +++ b/src/main.c @@ -343,7 +343,7 @@ static int parse_proc_cmdline_word(const char *word) { #ifdef HAVE_SYSV_COMPAT "systemd.sysv_console=0|1 Connect output of SysV scripts to console\n" #endif - "systemd.log_target=console|kmsg|syslog|syslog-or-kmsg|null\n" + "systemd.log_target=console|kmsg|journal|journal-or-kmsg|syslog|syslog-or-kmsg|null\n" " Log target\n" "systemd.log_level=LEVEL Log level\n" "systemd.log_color=0|1 Highlight important log messages\n" @@ -993,7 +993,7 @@ static int help(void) { #ifdef HAVE_SYSV_COMPAT " --sysv-console[=0|1] Connect output of SysV scripts to console\n" #endif - " --log-target=TARGET Set log target (console, syslog, kmsg, syslog-or-kmsg, null)\n" + " --log-target=TARGET Set log target (console, journal, syslog, kmsg, journal-or-kmsg, syslog-or-kmsg, null)\n" " --log-level=LEVEL Set log level (debug, info, notice, warning, err, crit, alert, emerg)\n" " --log-color[=0|1] Highlight important log messages\n" " --log-location[=0|1] Include code location in log messages\n" @@ -1177,7 +1177,7 @@ int main(int argc, char *argv[]) { if (getpid() == 1) { arg_running_as = MANAGER_SYSTEM; - log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_CONSOLE : LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_CONSOLE : LOG_TARGET_JOURNAL_OR_KMSG); if (!is_reexec) if (selinux_setup(&loaded_policy) < 0) diff --git a/src/manager.c b/src/manager.c index 54df7ebe..a549209c 100644 --- a/src/manager.c +++ b/src/manager.c @@ -195,6 +195,7 @@ static int manager_setup_signals(Manager *m) { SIGRTMIN+21, /* systemd: disable status messages */ SIGRTMIN+22, /* systemd: set log level to LOG_DEBUG */ SIGRTMIN+23, /* systemd: set log level to LOG_INFO */ + SIGRTMIN+26, /* systemd: set log target to journal-or-kmsg */ SIGRTMIN+27, /* systemd: set log target to console */ SIGRTMIN+28, /* systemd: set log target to kmsg */ SIGRTMIN+29, /* systemd: set log target to syslog-or-kmsg */ @@ -2293,6 +2294,11 @@ static int manager_process_signal_fd(Manager *m) { log_notice("Setting log level to info."); break; + case 26: + log_set_target(LOG_TARGET_JOURNAL_OR_KMSG); + log_notice("Setting log target to journal-or-kmsg."); + break; + case 27: log_set_target(LOG_TARGET_CONSOLE); log_notice("Setting log target to console."); @@ -3121,7 +3127,7 @@ int manager_set_default_controllers(Manager *m, char **controllers) { return 0; } -void manager_recheck_syslog(Manager *m) { +void manager_recheck_journal(Manager *m) { Unit *u; assert(m); @@ -3131,13 +3137,13 @@ void manager_recheck_syslog(Manager *m) { u = manager_get_unit(m, SPECIAL_JOURNALD_SOCKET); if (u && SOCKET(u)->state != SOCKET_RUNNING) { - log_close_syslog(); + log_close_journal(); return; } u = manager_get_unit(m, SPECIAL_JOURNALD_SERVICE); if (u && SERVICE(u)->state != SERVICE_RUNNING) { - log_close_syslog(); + log_close_journal(); return; } diff --git a/src/manager.h b/src/manager.h index 6e7558e1..0ace0c9f 100644 --- a/src/manager.h +++ b/src/manager.h @@ -289,7 +289,7 @@ void manager_check_finished(Manager *m); void manager_run_generators(Manager *m); void manager_undo_generators(Manager *m); -void manager_recheck_syslog(Manager *m); +void manager_recheck_journal(Manager *m); void manager_set_show_status(Manager *m, bool b); bool manager_get_show_status(Manager *m); diff --git a/src/modules-load.c b/src/modules-load.c index 8dd98f73..7384f25a 100644 --- a/src/modules-load.c +++ b/src/modules-load.c @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/src/quotacheck.c b/src/quotacheck.c index 60033a8e..b6648b83 100644 --- a/src/quotacheck.c +++ b/src/quotacheck.c @@ -87,7 +87,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/src/random-seed.c b/src/random-seed.c index 0c63794b..8b43baca 100644 --- a/src/random-seed.c +++ b/src/random-seed.c @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/src/rc-local-generator.c b/src/rc-local-generator.c index ac6424a7..56785cf4 100644 --- a/src/rc-local-generator.c +++ b/src/rc-local-generator.c @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c index 6bff32f4..7e6c243b 100644 --- a/src/readahead/readahead-collect.c +++ b/src/readahead/readahead-collect.c @@ -654,7 +654,7 @@ int main(int argc, char *argv[]) { int r; const char *root; - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/src/readahead/readahead-replay.c b/src/readahead/readahead-replay.c index 88c7a219..00d57c3d 100644 --- a/src/readahead/readahead-replay.c +++ b/src/readahead/readahead-replay.c @@ -338,7 +338,7 @@ int main(int argc, char*argv[]) { int r; const char *root; - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/src/remount-api-vfs.c b/src/remount-api-vfs.c index 7b146551..3e146ebb 100644 --- a/src/remount-api-vfs.c +++ b/src/remount-api-vfs.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/src/reply-password.c b/src/reply-password.c index bd55e65f..3a96049d 100644 --- a/src/reply-password.c +++ b/src/reply-password.c @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) { char packet[LINE_MAX]; size_t length; - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/src/shutdownd.c b/src/shutdownd.c index 19b16cbe..b4052d49 100644 --- a/src/shutdownd.c +++ b/src/shutdownd.c @@ -189,7 +189,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/src/system.conf b/src/system.conf index 2d1dd866..33d09bcc 100644 --- a/src/system.conf +++ b/src/system.conf @@ -9,7 +9,7 @@ [Manager] #LogLevel=info -#LogTarget=syslog-or-kmsg +#LogTarget=journal-or-kmsg #LogColor=yes #LogLocation=no #DumpCore=yes diff --git a/src/unit.c b/src/unit.c index e07d2c15..1fbfb1de 100644 --- a/src/unit.c +++ b/src/unit.c @@ -1338,7 +1338,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su } } - manager_recheck_syslog(u->meta.manager); + manager_recheck_journal(u->meta.manager); /* Maybe we finished startup and are now ready for being * stopped because unneeded? */ diff --git a/src/update-utmp.c b/src/update-utmp.c index 073f28e2..0d177d61 100644 --- a/src/update-utmp.c +++ b/src/update-utmp.c @@ -369,7 +369,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); diff --git a/units/fsck-root.service.in b/units/fsck-root.service.in index 7b3529db..40861491 100644 --- a/units/fsck-root.service.in +++ b/units/fsck-root.service.in @@ -18,6 +18,6 @@ ConditionPathExists=!/run/initramfs/root-fsck Type=oneshot RemainAfterExit=no ExecStart=@rootlibexecdir@/systemd-fsck -StandardOutput=syslog+console +StandardOutput=journal+console FsckPassNo=1 TimeoutSec=0 diff --git a/units/fsck@.service.in b/units/fsck@.service.in index e1f77363..c06684b6 100644 --- a/units/fsck@.service.in +++ b/units/fsck@.service.in @@ -16,5 +16,5 @@ Before=shutdown.target Type=oneshot RemainAfterExit=no ExecStart=@rootlibexecdir@/systemd-fsck %f -StandardOutput=syslog+console +StandardOutput=journal+console TimeoutSec=0 -- 2.39.5