From 2396fb04f78eaa9842c747e384218f0069446960 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 16 Aug 2010 22:39:02 +0200 Subject: [PATCH] log: properly open log target in the various utilities --- src/cgls.c | 1 + src/cgroups-agent.c | 1 + src/initctl.c | 1 + src/log.c | 6 +++--- src/logger.c | 1 + src/notify.c | 1 + src/random-seed.c | 2 ++ src/shutdownd.c | 1 + src/systemctl.c | 1 + src/update-utmp.c | 1 + 10 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/cgls.c b/src/cgls.c index c60f9eecc..2940e3724 100644 --- a/src/cgls.c +++ b/src/cgls.c @@ -75,6 +75,7 @@ int main(int argc, char *argv[]) { int r = 0, retval = 1; log_parse_environment(); + log_open(); if ((r = parse_argv(argc, argv)) < 0) goto finish; diff --git a/src/cgroups-agent.c b/src/cgroups-agent.c index ed1d43e7d..92b56c5fb 100644 --- a/src/cgroups-agent.c +++ b/src/cgroups-agent.c @@ -39,6 +39,7 @@ int main(int argc, char *argv[]) { log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); log_parse_environment(); + log_open(); /* If possible we go via the system bus, to make sure that * session instances get the messages. If not possible we talk diff --git a/src/initctl.c b/src/initctl.c index e1ab3f7e4..115452e86 100644 --- a/src/initctl.c +++ b/src/initctl.c @@ -349,6 +349,7 @@ int main(int argc, char *argv[]) { log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); log_parse_environment(); + log_open(); if ((n = sd_listen_fds(true)) < 0) { log_error("Failed to read listening file descriptors from environment: %s", strerror(-r)); diff --git a/src/log.c b/src/log.c index 8c20b9c9d..d6f4e3461 100644 --- a/src/log.c +++ b/src/log.c @@ -73,7 +73,7 @@ static int log_open_console(void) { return console_fd; } - log_info("Succesfully opened /dev/console for logging."); + log_debug("Succesfully opened /dev/console for logging."); } else console_fd = STDERR_FILENO; @@ -99,7 +99,7 @@ static int log_open_kmsg(void) { return -errno; } - log_info("Succesfully opened /dev/kmsg for logging."); + log_debug("Succesfully opened /dev/kmsg for logging."); return 0; } @@ -146,7 +146,7 @@ static int log_open_syslog(void) { goto fail; } - log_info("Succesfully opened syslog for logging."); + log_debug("Succesfully opened syslog for logging."); return 0; diff --git a/src/logger.c b/src/logger.c index 26bf888f2..64ac21404 100644 --- a/src/logger.c +++ b/src/logger.c @@ -547,6 +547,7 @@ int main(int argc, char *argv[]) { log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); log_parse_environment(); + log_open(); if ((n = sd_listen_fds(true)) < 0) { log_error("Failed to read listening file descriptors from environment: %s", strerror(-r)); diff --git a/src/notify.c b/src/notify.c index b914a7442..1c18c6bc0 100644 --- a/src/notify.c +++ b/src/notify.c @@ -134,6 +134,7 @@ int main(int argc, char* argv[]) { int r, retval = 1; log_parse_environment(); + log_open(); if ((r = parse_argv(argc, argv)) <= 0) { retval = r < 0; diff --git a/src/random-seed.c b/src/random-seed.c index 91aa6c6b4..b9cafb7cd 100644 --- a/src/random-seed.c +++ b/src/random-seed.c @@ -39,7 +39,9 @@ int main(int argc, char *argv[]) { return 1; } + log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); log_parse_environment(); + log_open(); /* When we load the seed we read it and write it to the device * and then immediately update the saved seed with new data, diff --git a/src/shutdownd.c b/src/shutdownd.c index d88982453..80ff2e9fb 100644 --- a/src/shutdownd.c +++ b/src/shutdownd.c @@ -192,6 +192,7 @@ int main(int argc, char *argv[]) { log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); log_parse_environment(); + log_open(); if ((n_fds = sd_listen_fds(true)) < 0) { log_error("Failed to read listening file descriptors from environment: %s", strerror(-r)); diff --git a/src/systemctl.c b/src/systemctl.c index a3186db4a..50473a182 100644 --- a/src/systemctl.c +++ b/src/systemctl.c @@ -4903,6 +4903,7 @@ int main(int argc, char*argv[]) { dbus_error_init(&error); log_parse_environment(); + log_open(); if ((r = parse_argv(argc, argv)) < 0) goto finish; diff --git a/src/update-utmp.c b/src/update-utmp.c index b5d733ca4..5a48bd98d 100644 --- a/src/update-utmp.c +++ b/src/update-utmp.c @@ -368,6 +368,7 @@ int main(int argc, char *argv[]) { log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); log_parse_environment(); + log_open(); #ifdef HAVE_AUDIT if ((c.audit_fd = audit_open()) < 0) -- 2.30.2