From 238fc589a1462f8d153048d64c98f221c5fedb7d Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Tue, 3 Mar 2015 18:14:26 +0900 Subject: [PATCH] Improve logging of configuration file operations --- config.c | 2 +- repmgr.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/config.c b/config.c index 96783c0a..cf521991 100644 --- a/config.c +++ b/config.c @@ -46,7 +46,7 @@ parse_config(const char *config_file, t_configuration_options *options) char config_file_buf[MAXLEN]; char name[MAXLEN]; char value[MAXLEN]; - bool config_file_provided = true; + bool config_file_provided = false; FILE *fp; /* Sanity checks */ diff --git a/repmgr.c b/repmgr.c index 2317093b..60587196 100644 --- a/repmgr.c +++ b/repmgr.c @@ -404,10 +404,12 @@ main(int argc, char **argv) } - if (runtime_options.verbose) - /* Logging is not yet set up, so using printf() */ - printf(_("Opening configuration file: %s\n"), - runtime_options.config_file); + if (runtime_options.verbose && runtime_options.config_file[0]) + { + + log_notice(_("Opening configuration file: %s\n"), + runtime_options.config_file); + } /* * The configuration file is not required for some actions (e.g. 'standby clone'), @@ -1053,7 +1055,6 @@ do_standby_clone(void) exit(ERR_BAD_CONFIG); } - log_debug(_("standby clone: %i tuples\n"), PQntuples(res)); for (i = 0; i < PQntuples(res); i++) { if (strcmp(PQgetvalue(res, i, 0), "data_directory") == 0) @@ -2276,12 +2277,12 @@ run_basebackup() termPQExpBuffer(¶ms); log_info(_("Executing: '%s'\n"), script); - r = system(script); /* * As of 9.4, pg_basebackup et al only ever return 0 or 1 */ - log_debug(_("r = %i, %i\n"), r, WEXITSTATUS(r)); + + r = system(script); return r; }