ctdb-daemon: Log the logging location when not logging via syslog()
authorMartin Schwenke <martin@meltin.net>
Mon, 16 Apr 2018 09:05:54 +0000 (19:05 +1000)
committerMartin Schwenke <martins@samba.org>
Tue, 1 May 2018 11:31:19 +0000 (13:31 +0200)
A variant of this is currently done by the wrapper but will be removed
from there because the wrapper will no longer see the CTDB_LOGGING
option.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdbd.c

index 93a0e8d6dfe6a4e01c21f935cfb6b549dd6a050e..b9c502c22b49f56a91bd355342bebdd1211d9f08 100644 (file)
@@ -22,6 +22,7 @@
 #include "system/time.h"
 #include "system/wait.h"
 #include "system/network.h"
+#include "system/syslog.h"
 
 #include <popt.h>
 #include <talloc.h>
@@ -261,6 +262,13 @@ int main(int argc, const char *argv[])
                options.logging = "file:";
        }
 
+       if (strcmp(options.logging, "syslog") != 0) {
+               /* This can help when CTDB logging is misconfigured */
+               syslog(LOG_DAEMON|LOG_NOTICE,
+                      "CTDB logging to location %s",
+                      options.logging);
+       }
+
        /* Initialize logging and set the debug level */
        if (!ctdb_logging_init(ctdb, options.logging, options.debuglevel)) {
                goto fail;