Parcourir la source

[1454] Logging

Michal 'vorner' Vaner il y a 13 ans
Parent
commit
25768c5398
2 fichiers modifiés avec 21 ajouts et 1 suppressions
  1. 5 1
      src/bin/ddns/ddns.py.in
  2. 16 0
      src/bin/ddns/ddns_messages.mes

+ 5 - 1
src/bin/ddns/ddns.py.in

@@ -34,6 +34,7 @@ import signal
 
 isc.log.init("b10-ddns")
 logger = isc.log.Logger("ddns")
+DBG_ACTIVITY = logger.DBGLVL_TRACE_BASIC
 
 DATA_PATH = bind10_config.DATA_PATH
 if "B10_FROM_SOURCE" in os.environ:
@@ -135,6 +136,7 @@ class DDNSServer:
         """
         socket = self._listen_socket.accept()
         fileno = socket.fileno()
+        logger.debug(DBG_ACTIVITY, DDNS_NEW_CONN, fileno)
         session = isc.util.io.socketsession.SocketSessionReceiver(socket)
         self._socket_sessions[fileno] = (socket, session)
 
@@ -155,13 +157,15 @@ class DDNSServer:
         """
         Handle incoming event on the socket with given fileno.
         """
+        logger.debug(DBG_ACTIVITY, DDNS_INCOMING, fileno)
         (socket, session) = self._socket_sessions[fileno]
         try:
             request = session.pop()
             self.handle_request(request)
-        except isc.util.io.socketsession.SocketSessionError:
+        except isc.util.io.socketsession.SocketSessionError as se:
             # No matter why this failed, the connection is in unknown, possibly
             # broken state. So, we close the socket and remove the session.
+            logger.warn(DDNS_DROP_CONN, fileno, se)
             del self._socket_sessions[fileno]
             socket.close()
 

+ 16 - 0
src/bin/ddns/ddns_messages.mes

@@ -32,6 +32,18 @@ configuration manager b10-cfgmgr is not running.
 The ddns process encountered an error when installing the configuration at
 startup time.  Details of the error are included in the log message.
 
+% DDNS_DROP_CONN dropping connection on file descriptor %1 because of error %2
+There was an error on a connection with the b10-auth server (or whatever
+connects to the ddns daemon). This might be OK, for example when the
+authoritative server shuts down, the connection would get closed. It also
+can mean the system is busy and can't keep up or that the other side got
+confused and sent bad data.
+
+% DDNS_INCOMING incoming activity on file descriptor %1
+A debug message, informing there's some activity on the given file descriptor.
+It will be either a request or the file descriptor will be closed. See
+following log messages to see what of it.
+
 % DDNS_MODULECC_SESSION_ERROR error encountered by configuration/command module: %1
 There was a problem in the lower level module handling configuration and
 control commands.  This could happen for various reasons, but the most likely
@@ -39,6 +51,10 @@ cause is that the configuration database contains a syntax error and ddns
 failed to start at initialization.  A detailed error message from the module
 will also be displayed.
 
+% DDNS_NEW_CONN new connection on file descriptor %1
+Debug message. We received a connection and we are going to start handling
+requests from it.
+
 % DDNS_RECEIVED_SHUTDOWN_COMMAND shutdown command received
 The ddns process received a shutdown command from the command channel
 and will now shut down.