Log at info level the success of a luxi query
authorKlaus Aehlig <aehlig@google.com>
Mon, 29 Apr 2013 12:08:17 +0000 (14:08 +0200)
committerKlaus Aehlig <aehlig@google.com>
Mon, 29 Apr 2013 14:49:07 +0000 (16:49 +0200)
So far, any successful query was only logged at debug level, thus leaving
no traces in the logs, unless debugging was enabled. Therefore, we add
a notes about successful completion at info level. Also, repeat a failed
request at WARN level, so that, even if debugging disabled, the request
is available together with the error message in the logs.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

src/Ganeti/Query/Server.hs

index f4a9e78..76fcfd6 100644 (file)
@@ -175,7 +175,6 @@ handleCall _ op =
   return . Bad $
     GenericError ("Luxi call '" ++ strOfOp op ++ "' not implemented")
 
-
 -- | Given a decoded luxi request, executes it and sends the luxi
 -- response back to the client.
 handleClientMsg :: Client -> ConfigReader -> LuxiOp -> IO Bool
@@ -186,11 +185,13 @@ handleClientMsg client creader args = do
   (!status, !rval) <-
     case call_result of
       Bad err -> do
-        logWarning $ "Failed to execute request: " ++ show err
+        logWarning $ "Failed to execute request " ++ show args ++ ": "
+                     ++ show err
         return (False, showJSON err)
       Ok result -> do
         -- only log the first 2,000 chars of the result
         logDebug $ "Result (truncated): " ++ take 2000 (J.encode result)
+        logInfo $ "Successfully handled " ++ strOfOp args
         return (True, result)
   sendMsg client $ buildResponse status rval
   return True