mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
repmgr: always log to STDERR even if log facility defined
This commit is contained in:
3
HISTORY
3
HISTORY
@@ -1,3 +1,6 @@
|
||||
3.2.2 2016-11-23
|
||||
repmgr: always log to STDERR even if log facility defined (Ian)
|
||||
|
||||
3.2.1 2016-10-24
|
||||
repmgr: require a valid repmgr cluster name unless -F/--force
|
||||
supplied (Ian)
|
||||
|
||||
2
config.c
2
config.c
@@ -752,7 +752,7 @@ reload_config(t_configuration_options *orig_options)
|
||||
{
|
||||
log_notice(_("restarting logging with changed parameters\n"));
|
||||
logger_shutdown();
|
||||
logger_init(orig_options, progname());
|
||||
logger_init(orig_options, progname(), false);
|
||||
}
|
||||
|
||||
if (config_changed == true)
|
||||
|
||||
9
log.c
9
log.c
@@ -142,7 +142,7 @@ log_verbose(int level, const char *fmt, ...)
|
||||
|
||||
|
||||
bool
|
||||
logger_init(t_configuration_options *opts, const char *ident)
|
||||
logger_init(t_configuration_options *opts, const char *ident, bool stderr_only)
|
||||
{
|
||||
char *level = opts->loglevel;
|
||||
char *facility = opts->logfacility;
|
||||
@@ -176,6 +176,13 @@ logger_init(t_configuration_options *opts, const char *ident)
|
||||
stderr_log_warning(_("Invalid log level \"%s\" (available values: DEBUG, INFO, NOTICE, WARNING, ERR, ALERT, CRIT or EMERG)\n"), level);
|
||||
}
|
||||
|
||||
/*
|
||||
* STDERR only logging requested - finish here without setting up any further
|
||||
* logging facility.
|
||||
*/
|
||||
if (stderr_only == true)
|
||||
return true;
|
||||
|
||||
if (facility && *facility)
|
||||
{
|
||||
|
||||
|
||||
2
log.h
2
log.h
@@ -116,7 +116,7 @@ int detect_log_level(const char *level);
|
||||
|
||||
/* Logger initialisation and shutdown */
|
||||
|
||||
bool logger_init(t_configuration_options * opts, const char *ident);
|
||||
bool logger_init(t_configuration_options * opts, const char *ident, bool stderr_only);
|
||||
|
||||
bool logger_shutdown(void);
|
||||
|
||||
|
||||
10
repmgr.c
10
repmgr.c
@@ -832,14 +832,12 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the logger. If verbose command line parameter was input,
|
||||
* make sure that the log level is at least INFO. This is mainly useful
|
||||
* for STANDBY CLONE. That doesn't require a configuration file where a
|
||||
* logging level might be specified at, but it often requires detailed
|
||||
* logging to troubleshoot problems.
|
||||
* Initialize the logger. We'll request STDERR logging only to ensure the
|
||||
* repmgr command never has its output diverted to a logging facility,
|
||||
* which makes little sense for a command line program.
|
||||
*/
|
||||
|
||||
logger_init(&options, progname());
|
||||
logger_init(&options, progname(), true);
|
||||
|
||||
if (runtime_options.verbose)
|
||||
logger_set_verbose();
|
||||
|
||||
Reference in New Issue
Block a user