chiark / gitweb /
main: add a few more useful diagnostic log messages
authorLennart Poettering <lennart@poettering.net>
Sat, 10 Jul 2010 02:50:19 +0000 (04:50 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 10 Jul 2010 02:50:19 +0000 (04:50 +0200)
src/dbus.c
src/manager.c
src/unit.c

index 1620469..7f8b6a0 100644 (file)
@@ -338,10 +338,12 @@ static DBusHandlerResult api_bus_message_filter(DBusConnection *connection, DBus
 
         dbus_error_init(&error);
 
-        log_debug("Got D-Bus request: %s.%s() on %s",
-                  dbus_message_get_interface(message),
-                  dbus_message_get_member(message),
-                  dbus_message_get_path(message));
+        if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_METHOD_CALL ||
+            dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_SIGNAL)
+                log_debug("Got D-Bus request: %s.%s() on %s",
+                          dbus_message_get_interface(message),
+                          dbus_message_get_member(message),
+                          dbus_message_get_path(message));
 
         if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
                 log_error("Warning! API D-Bus connection terminated.");
@@ -443,10 +445,13 @@ static DBusHandlerResult system_bus_message_filter(DBusConnection *connection, D
 
         dbus_error_init(&error);
 
-        log_debug("Got D-Bus request: %s.%s() on %s",
-                  dbus_message_get_interface(message),
-                  dbus_message_get_member(message),
-                  dbus_message_get_path(message));
+        if (m->api_bus != m->system_bus &&
+            (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_METHOD_CALL ||
+             dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_SIGNAL))
+                log_debug("Got D-Bus request on system bus: %s.%s() on %s",
+                          dbus_message_get_interface(message),
+                          dbus_message_get_member(message),
+                          dbus_message_get_path(message));
 
         if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
                 log_error("Warning! System D-Bus connection terminated.");
@@ -474,10 +479,12 @@ static DBusHandlerResult private_bus_message_filter(DBusConnection *connection,
         assert(message);
         assert(m);
 
-        log_debug("Got D-Bus request: %s.%s() on %s",
-                  dbus_message_get_interface(message),
-                  dbus_message_get_member(message),
-                  dbus_message_get_path(message));
+        if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_METHOD_CALL ||
+            dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_SIGNAL)
+                log_debug("Got D-Bus request: %s.%s() on %s",
+                          dbus_message_get_interface(message),
+                          dbus_message_get_member(message),
+                          dbus_message_get_path(message));
 
         if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected"))
                 shutdown_connection(m, connection);
index 638ef2f..a643263 100644 (file)
@@ -1768,6 +1768,8 @@ static int manager_start_target(Manager *m, const char *name, JobMode mode) {
 
         dbus_error_init(&error);
 
+        log_info("Activating special unit %s", name);
+
         if ((r = manager_add_job_by_name(m, JOB_START, name, mode, true, &error, NULL)) < 0)
                 log_error("Failed to enqueue %s job: %s", name, bus_error(&error, r));
 
@@ -1795,6 +1797,8 @@ static int manager_process_signal_fd(Manager *m) {
                         return -errno;
                 }
 
+                log_debug("Received SIG%s", strna(signal_to_string(sfsi.ssi_signo)));
+
                 switch (sfsi.ssi_signo) {
 
                 case SIGCHLD:
@@ -1905,7 +1909,7 @@ static int manager_process_signal_fd(Manager *m) {
                                 break;
                         }
 
-                        log_info("Got unhandled signal <%s>.", strsignal(sfsi.ssi_signo));
+                        log_warning("Got unhandled signal <%s>.", strna(signal_to_string(sfsi.ssi_signo)));
                 }
                 }
         }
index a5f8712..c287310 100644 (file)
@@ -970,6 +970,9 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
         else if (UNIT_IS_ACTIVE_OR_RELOADING(os) && !UNIT_IS_ACTIVE_OR_RELOADING(ns))
                 u->meta.active_exit_timestamp = ts;
 
+        if (ns != os && ns == UNIT_MAINTENANCE)
+                log_notice("Unit %s entered maintenance state.", u->meta.id);
+
         timer_unit_notify(u, ns);
         path_unit_notify(u, ns);