mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-25 08:06:29 +00:00
Repurpose -v/--verbose; add -t/--terse option (repmgr only)
repmgr and particularly repmgrd currently produce substantial
amounts of log output. Much of this is only useful when troubleshooting
or debugging.
Previously the -v/--verbose option just forced the log level to
INFO. With repmgrd this is pretty pointless - just set the log
level in the configuration file. With repmgr the configuration
file can be overriden by the new -L/--log-level option.
-v/--verbose now provides an additional, chattier/pedantic level
of logging ("Opening *this* logfile", "Executing *this* query",
"running in *this* loop") which is helpful for understanding
repmgr/repmgrd's behaviour, particularly for troubleshooting.
What additional verbose logging is generated will of course a
also depends on the log level set, so e.g. someone trying to
work out which configuration file is actually being opened
can use '--log-level=INFO --verbose' without being bothered
by an avalanche of extra verbose debugging output.
-t/--terse option will silence certain non-essential output, at
the moment any HINTs.
Note that -v/--verbose and -t/--terse are not mutually exclusive
(suggestions for better names welcome).
This commit is contained in:
17
repmgrd.c
17
repmgrd.c
@@ -232,7 +232,7 @@ main(int argc, char **argv)
|
||||
logger_init(&local_options, progname(), local_options.loglevel,
|
||||
local_options.logfacility);
|
||||
if (verbose)
|
||||
logger_min_verbose(LOG_INFO);
|
||||
logger_set_verbose();
|
||||
|
||||
if (log_type == REPMGR_SYSLOG)
|
||||
{
|
||||
@@ -246,6 +246,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Initialise the repmgr schema name */
|
||||
/* XXX check this handles quoting properly */
|
||||
maxlen_snprintf(repmgr_schema, "%s%s", DEFAULT_REPMGR_SCHEMA_PREFIX,
|
||||
local_options.cluster_name);
|
||||
|
||||
@@ -456,10 +457,7 @@ main(int argc, char **argv)
|
||||
|
||||
do
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
log_debug("standby check loop...\n");
|
||||
}
|
||||
log_verbose(LOG_DEBUG, "standby check loop...\n");
|
||||
|
||||
if (node_info.type == WITNESS)
|
||||
{
|
||||
@@ -469,6 +467,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
standby_monitor();
|
||||
}
|
||||
|
||||
sleep(local_options.monitor_interval_secs);
|
||||
|
||||
if (got_SIGHUP)
|
||||
@@ -1056,10 +1055,7 @@ standby_monitor(void)
|
||||
* Execute the query asynchronously, but don't check for a result. We will
|
||||
* check the result next time we pause for a monitor step.
|
||||
*/
|
||||
if (verbose)
|
||||
{
|
||||
log_debug("standby_monitor:() %s\n", sqlquery);
|
||||
}
|
||||
log_verbose(LOG_DEBUG, "standby_monitor:() %s\n", sqlquery);
|
||||
|
||||
if (PQsendQuery(master_conn, sqlquery) == 0)
|
||||
log_warning(_("query could not be sent to master. %s\n"),
|
||||
@@ -1464,8 +1460,7 @@ do_master_failover(void)
|
||||
/* wait */
|
||||
sleep(5);
|
||||
|
||||
if (verbose)
|
||||
log_info(_("this node is the best candidate to be the new master, promoting...\n"));
|
||||
log_notice(_("this node is the best candidate to be the new master, promoting...\n"));
|
||||
|
||||
log_debug(_("promote command is: \"%s\"\n"),
|
||||
local_options.promote_command);
|
||||
|
||||
Reference in New Issue
Block a user