X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flog.c;h=cc636a2dfac16e7fab8b1206717d3c1eb00e1a14;hp=2dd3e978ff1f2e1a0611ef0f7d8935f70cb719b5;hb=31a7034d38fd7550699e6fbd002bbe42d9ea3b7e;hpb=c31e14954b158351b11f886332229a61fff2e5d1 diff --git a/src/log.c b/src/log.c index 2dd3e978f..cc636a2df 100644 --- a/src/log.c +++ b/src/log.c @@ -96,7 +96,7 @@ static int log_open_kmsg(void) { return 0; if ((kmsg_fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC)) < 0) { - log_info("Failed to open /dev/kmsg for logging: %s", strerror(errno)); + log_error("Failed to open /dev/kmsg for logging: %s", strerror(errno)); return -errno; } @@ -177,7 +177,7 @@ static int log_open_syslog(void) { fail: log_close_syslog(); - log_info("Failed to open syslog for logging: %s", strerror(-r)); + log_debug("Failed to open syslog for logging: %s", strerror(-r)); return r; } @@ -212,6 +212,9 @@ int log_open(void) { } log_close_syslog(); + + /* Get the real /dev/console if we are PID=1, hence reopen */ + log_close_console(); return log_open_console(); } @@ -300,7 +303,7 @@ static int write_to_syslog( IOVEC_SET_STRING(iovec[3], header_pid); IOVEC_SET_STRING(iovec[4], buffer); - /* When using syslog via SOCK_STREAM seperate the messages by NUL chars */ + /* When using syslog via SOCK_STREAM separate the messages by NUL chars */ if (syslog_is_stream) iovec[4].iov_len++; @@ -519,10 +522,9 @@ void log_parse_environment(void) { if (log_show_color_from_string(e) < 0) log_warning("Failed to parse bool %s. Ignoring.", e); - if ((e = getenv("SYSTEMD_LOG_LOCATION"))) { + if ((e = getenv("SYSTEMD_LOG_LOCATION"))) if (log_show_location_from_string(e) < 0) log_warning("Failed to parse bool %s. Ignoring.", e); - } } LogTarget log_get_target(void) {