]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
bus: Add sender name to bus activation log messages
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Sat, 1 Oct 2016 13:59:47 +0000 (15:59 +0200)
committerSimon McVittie <smcv@debian.org>
Wed, 5 Oct 2016 18:32:45 +0000 (19:32 +0100)
This clarifies
   Activating via systemd: service name='com.example.Example'
   unit='example.service'
to
   Activating via systemd: service name='com.example.Example'
   unit='example.service' requested by ':1.23' (uid 1000 pid 123
   comm "whatever-activat")

Similarly for the non-systemd code paths.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68212
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
bus/activation.c

index c614d520d94fe40e22aea65e01e226242d78a564..2c5ef9dcf587aa34ec4ecfb8686a423c9166f5f6 100644 (file)
@@ -1965,9 +1965,11 @@ bus_activation_activate_service (BusActivation  *activation,
           if (service != NULL)
             {
               bus_context_log (activation->context,
-                               DBUS_SYSTEM_LOG_INFO, "Activating via systemd: service name='%s' unit='%s'",
+                               DBUS_SYSTEM_LOG_INFO, "Activating via systemd: service name='%s' unit='%s' requested by '%s' (%s)",
                                service_name,
-                               entry->systemd_service);
+                               entry->systemd_service,
+                               bus_connection_get_name (connection),
+                               bus_connection_get_loginfo (connection));
               /* Wonderful, systemd is connected, let's just send the msg */
               retval = bus_dispatch_matches (activation_transaction, NULL,
                                              systemd, message, error);
@@ -1975,9 +1977,11 @@ bus_activation_activate_service (BusActivation  *activation,
           else
             {
               bus_context_log (activation->context,
-                               DBUS_SYSTEM_LOG_INFO, "Activating systemd to hand-off: service name='%s' unit='%s'",
+                               DBUS_SYSTEM_LOG_INFO, "Activating systemd to hand-off: service name='%s' unit='%s' requested by '%s' (%s)",
                                service_name,
-                               entry->systemd_service);
+                               entry->systemd_service,
+                               bus_connection_get_name (connection),
+                               bus_connection_get_loginfo (connection));
               /* systemd is not around, let's "activate" it. */
               retval = bus_activation_activate_service (activation, NULL, activation_transaction, TRUE,
                                                         message, "org.freedesktop.systemd1", error);
@@ -2089,12 +2093,16 @@ bus_activation_activate_service (BusActivation  *activation,
   _dbus_verbose ("Spawning %s ...\n", argv[0]);
   if (servicehelper != NULL)
     bus_context_log (activation->context,
-                     DBUS_SYSTEM_LOG_INFO, "Activating service name='%s' (using servicehelper)",
-                     service_name);
+                     DBUS_SYSTEM_LOG_INFO, "Activating service name='%s' requested by '%s' (%s) (using servicehelper)",
+                     service_name,
+                     bus_connection_get_name (connection),
+                     bus_connection_get_loginfo (connection));
   else
     bus_context_log (activation->context,
-                     DBUS_SYSTEM_LOG_INFO, "Activating service name='%s'",
-                     service_name);
+                     DBUS_SYSTEM_LOG_INFO, "Activating service name='%s' requested by '%s' (%s)",
+                     service_name,
+                     bus_connection_get_name (connection),
+                     bus_connection_get_loginfo (connection));
 
   dbus_error_init (&tmp_error);