]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pid1: more informative error message for ignored notifications
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 29 Sep 2016 14:07:41 +0000 (16:07 +0200)
committerMartin Pitt <martin.pitt@ubuntu.com>
Thu, 29 Sep 2016 20:57:57 +0000 (22:57 +0200)
It's probably easier to diagnose a bad notification message if the
contents are printed. But still, do anything only if debugging is on.

src/core/manager.c

index 1ea6539ebc42a0461bff2c200bb2ebdd69d63fd3..0f95bf49fb7124a4424f54710d87a358c044608b 100644 (file)
@@ -1672,8 +1672,14 @@ static void manager_invoke_notify_message(Manager *m, Unit *u, pid_t pid, const
 
         if (UNIT_VTABLE(u)->notify_message)
                 UNIT_VTABLE(u)->notify_message(u, pid, tags, fds);
-        else
-                log_unit_debug(u, "Got notification message for unit. Ignoring.");
+        else if (_unlikely_(log_get_max_level() >= LOG_DEBUG)) {
+                _cleanup_free_ char *x = NULL, *y = NULL;
+
+                x = cescape(buf);
+                if (x)
+                        y = ellipsize(x, 20, 90);
+                log_unit_debug(u, "Got notification message \"%s\", ignoring.", strnull(y));
+        }
 }
 
 static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t revents, void *userdata) {