summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-10-20 01:48:35 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-19 19:48:35 -0400
commit5368222db6093195dbbd5fc7418508b154b1b769 (patch)
tree315df706e884c29503588a46522d6c6beff816b1 /src
parent45c0de1f3cb04afd9704db12ce2a7a488906cc7e (diff)
core: let's upgrade the log level for service processes dying of signal (#4415)
As suggested in https://github.com/systemd/systemd/pull/4367#issuecomment-253670328
Diffstat (limited to 'src')
-rw-r--r--src/core/service.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/service.c b/src/core/service.c
index c949de9cbe..f9127d7509 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2646,7 +2646,14 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
f = SERVICE_SUCCESS;
}
- log_struct(f == SERVICE_SUCCESS ? LOG_DEBUG : LOG_NOTICE,
+ /* When this is a successful exit, let's log about the exit code on DEBUG level. If this is a failure
+ * and the process exited on its own via exit(), then let's make this a NOTICE, under the assumption
+ * that the service already logged the reason at a higher log level on its own. However, if the service
+ * died due to a signal, then it most likely didn't say anything about any reason, hence let's raise
+ * our log level to WARNING then. */
+
+ log_struct(f == SERVICE_SUCCESS ? LOG_DEBUG :
+ (code == CLD_EXITED ? LOG_NOTICE : LOG_WARNING),
LOG_UNIT_ID(u),
LOG_UNIT_MESSAGE(u, "Main process exited, code=%s, status=%i/%s",
sigchld_code_to_string(code), status,