X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Flog.c;h=6a10dc4540ed288032f6fefb3ccedaf730d777a3;hb=e9d21f240704f87c6bb5f7fca1c5e6d0f31c84cd;hp=9fffc1dbc00ba2123cae35afbf3d4eb0156865eb;hpb=d7832d2c6e0ef5f2839a2296c1cc2fc85c7d9632;p=elogind.git diff --git a/src/shared/log.c b/src/shared/log.c index 9fffc1dbc..6a10dc454 100644 --- a/src/shared/log.c +++ b/src/shared/log.c @@ -6,16 +6,16 @@ Copyright 2010 Lennart Poettering systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. systemd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see . ***/ @@ -240,7 +240,7 @@ int log_open(void) { return 0; } - if (log_target != LOG_TARGET_AUTO || + if ((log_target != LOG_TARGET_AUTO && log_target != LOG_TARGET_SAFE) || getpid() == 1 || isatty(STDERR_FILENO) <= 0) { @@ -266,6 +266,7 @@ int log_open(void) { } if (log_target == LOG_TARGET_AUTO || + log_target == LOG_TARGET_SAFE || log_target == LOG_TARGET_JOURNAL_OR_KMSG || log_target == LOG_TARGET_SYSLOG_OR_KMSG || log_target == LOG_TARGET_KMSG) { @@ -466,12 +467,14 @@ static int write_to_journal( "CODE_FILE=%s\n" "CODE_LINE=%i\n" "CODE_FUNCTION=%s\n" + "SYSLOG_IDENTIFIER=%s\n" "MESSAGE=", LOG_PRI(level), LOG_FAC(level), file, line, - func); + func, + program_invocation_short_name); char_array_0(header); @@ -545,7 +548,9 @@ static int log_dispatch( if (k <= 0 && (log_target == LOG_TARGET_AUTO || + log_target == LOG_TARGET_SAFE || log_target == LOG_TARGET_SYSLOG_OR_KMSG || + log_target == LOG_TARGET_JOURNAL_OR_KMSG || log_target == LOG_TARGET_KMSG)) { k = write_to_kmsg(level, file, line, func, buffer); @@ -741,6 +746,7 @@ static const char *const log_target_table[] = { [LOG_TARGET_SYSLOG] = "syslog", [LOG_TARGET_SYSLOG_OR_KMSG] = "syslog-or-kmsg", [LOG_TARGET_AUTO] = "auto", + [LOG_TARGET_SAFE] = "safe", [LOG_TARGET_NULL] = "null" };