From: Martin Schwenke Date: Wed, 17 Oct 2018 10:24:07 +0000 (+1100) Subject: ctdb-daemon: Avoid unnecessarily spamming the logs when in test mode X-Git-Tag: tdb-1.3.17~902 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c84254d23d62d57be8ebdd24659c426210ca0213;p=thirdparty%2Fsamba.git ctdb-daemon: Avoid unnecessarily spamming the logs when in test mode Logging the logging location to syslog can be useful on production systems when the configuration goes unexpectedly missing. However, in test mode this just adds noise to the logs on the test system. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c index 9a8e0e8c3f4..2377399b2ac 100644 --- a/ctdb/server/ctdbd.c +++ b/ctdb/server/ctdbd.c @@ -167,7 +167,7 @@ int main(int argc, const char *argv[]) const char *ctdb_base; struct conf_context *conf; const char *logging_location; - const char *t; + const char *test_mode; bool ok; /* @@ -238,6 +238,8 @@ int main(int argc, const char *argv[]) * Logging setup/options */ + test_mode = getenv("CTDB_TEST_MODE"); + /* Log to stderr (ignoring configuration) when running as interactive */ if (interactive) { logging_location = "file:"; @@ -246,7 +248,7 @@ int main(int argc, const char *argv[]) logging_location = logging_conf_location(conf); } - if (strcmp(logging_location, "syslog") != 0) { + if (strcmp(logging_location, "syslog") != 0 && test_mode == NULL) { /* This can help when CTDB logging is misconfigured */ syslog(LOG_DAEMON|LOG_NOTICE, "CTDB logging to location %s", @@ -363,8 +365,7 @@ int main(int argc, const char *argv[]) * Testing and debug options */ - t = getenv("CTDB_TEST_MODE"); - if (t != NULL) { + if (test_mode != NULL) { ctdb->do_setsched = false; ctdb->do_checkpublicip = false; fast_start = true;