log: properly open log target in the various utilities

This commit is contained in:
Lennart Poettering 2010-08-16 22:39:02 +02:00
parent 618e02c7b7
commit 2396fb04f7
10 changed files with 13 additions and 3 deletions

View File

@ -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;

View File

@ -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

View File

@ -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));

View File

@ -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;

View File

@ -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));

View File

@ -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;

View File

@ -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,

View File

@ -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));

View File

@ -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;

View File

@ -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)