ctdb-daemon: Log to stderr when running in interactive mode
authorAmitay Isaacs <amitay@gmail.com>
Tue, 29 Nov 2016 06:52:00 +0000 (17:52 +1100)
committerMartin Schwenke <martins@samba.org>
Mon, 5 Dec 2016 07:09:23 +0000 (08:09 +0100)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/server/ctdb_daemon.c
ctdb/server/ctdbd.c

index b91099d0623d6f8b93b25af248f74f7e336efac5..2e8cbb3b63243bbdca54a4b79acefc788778915d 100644 (file)
@@ -1291,7 +1291,9 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
                exit(1);
        }
 
-       ctdb_set_child_logging(ctdb);
+       if (do_fork) {
+               ctdb_set_child_logging(ctdb);
+       }
 
        TALLOC_FREE(ctdb->srv);
        if (srvid_init(ctdb, &ctdb->srv) != 0) {
index 0535872d844d403e48e2e175db19142485fada53..dcd54c228532b287c1f7e12483993a38c0c663dd 100644 (file)
@@ -198,6 +198,11 @@ int main(int argc, const char *argv[])
                ctdb_set_flags(ctdb, CTDB_FLAG_TORTURE);
        }
 
+       /* Log to stderr when running as interactive */
+       if (interactive) {
+               options.logging = "file:";
+       }
+
        /* Initialize logging and set the debug level */
        if (!ctdb_logging_init(ctdb, options.logging, options.debuglevel)) {
                exit(1);