From 8b059bc9b0bddab167da02f7979025330912dbbe Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Thu, 12 Jul 2018 12:04:52 +0900 Subject: [PATCH] Change default for "log_level" to INFO Default was previously NOTICE (as in repmgr 3.x) but documentation implied it was INFO, and many of the the documentation examples assume it is. This produces some quite informative log output, without creating excessive log file volume. In particular it's useful to get a better idea of what repmgrd is actually doing. Also add documentation section for the log configuration parameters. GitHub #470, containing change suggested in GitHub #467. --- HISTORY | 1 + doc/appendix-release-notes.sgml | 24 ++++- doc/configuration-file-log-settings.sgml | 107 +++++++++++++++++++++++ doc/configuration.sgml | 1 + doc/filelist.sgml | 1 + log.c | 4 +- repmgr.conf.sample | 2 +- 7 files changed, 136 insertions(+), 4 deletions(-) create mode 100644 doc/configuration-file-log-settings.sgml diff --git a/HISTORY b/HISTORY index a7996d6e..57b22526 100644 --- a/HISTORY +++ b/HISTORY @@ -1,4 +1,5 @@ 4.1.0 2018-??-?? + repmgr: change default log_level to INFO, add documentation; GitHub #470 (Ian) repmgr: add "--missing-slots" check to "repmgr node check" (Ian) repmgr: improve command line error handling; GitHub #464 (Ian) repmgr: fix "standby register --wait-sync" when no timeout provided (Ian) diff --git a/doc/appendix-release-notes.sgml b/doc/appendix-release-notes.sgml index 51417eb2..4399d861 100644 --- a/doc/appendix-release-notes.sgml +++ b/doc/appendix-release-notes.sgml @@ -33,12 +33,32 @@ review changes listed below. + + Configuration file changes + + + + + + + Default for is now . + This produces additional informative log output, without creating excessive additional + log file volume, and matches the setting assumed for examples in the documentation. + (GitHub #470). + + + + + + + + repmgr enhancements - + repmgr: always exit with an error if an unrecognised command line option is provided. This matches the behaviour of other PostgreSQL @@ -53,6 +73,8 @@ repmgr node status return non-zero exit code if node status issues detected. (GitHub #456). + + diff --git a/doc/configuration-file-log-settings.sgml b/doc/configuration-file-log-settings.sgml new file mode 100644 index 00000000..e4977d29 --- /dev/null +++ b/doc/configuration-file-log-settings.sgml @@ -0,0 +1,107 @@ + + + repmgr.conf + log settings + + + log settings + configuration in repmgr.conf + + Log settings + + + By default, &repmgr; and repmgrd write log output to + STDERR. An alternative log destination can be specified + (either a file or syslog). + + + + + The &repmgr; application itself will continue to write log output to STDERR + even if another log destination is configured, as otherwise any output resulting from a command + line operation will "disappear" into the log. + + + This behaviour can be overriden with the command line option , + which will redirect all logging output to the configured log destination. This is recommended + when &repmgr; is executed by another application, particularly repmgrd, + to enable log output generated by the &repmgr; application to be stored for later reference. + + + + + + + log_level (string) + + log_level configuration file parameter + + + + + One of , , , + , , , + or . + + + Default is . + + + Note that will produce a substantial amount of log output + and should not be enabled in normal use. + + + + + + log_facility (string) + + log_facility configuration file parameter + + + + + Logging facility: possible values are (default), or for + syslog integration, one of , , , + , . + + + + + + log_file (string) + + log_file configuration file parameter + + + + + If is set to , log output + can be redirected to the specified file. + + + See for information on configuring log rotation. + + + + + + log_status_interval (integer) + + log_status_interval configuration file parameter + + + + + This setting causes repmgrd to emit a status log + line at the specified interval (in seconds, default 300) + describing repmgrd's current state, e.g.: + + + [2018-07-12 00:47:32] [INFO] monitoring connection to upstream node "node1" (node ID: 1) + + + + + + diff --git a/doc/configuration.sgml b/doc/configuration.sgml index 96426e65..a7d99d70 100644 --- a/doc/configuration.sgml +++ b/doc/configuration.sgml @@ -3,6 +3,7 @@ &configuration-file; &configuration-file-required-settings; + &configuration-file-log-settings; &configuration-file-service-commands; diff --git a/doc/filelist.sgml b/doc/filelist.sgml index cd6d6a55..7a1faa71 100644 --- a/doc/filelist.sgml +++ b/doc/filelist.sgml @@ -39,6 +39,7 @@ + diff --git a/log.c b/log.c index fb2cb507..afaf02be 100644 --- a/log.c +++ b/log.c @@ -42,7 +42,7 @@ _stderr_log_with_level(const char *level_name, int level, const char *fmt, va_li __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 0))); int log_type = REPMGR_STDERR; -int log_level = LOG_NOTICE; +int log_level = LOG_INFO; int last_log_level = LOG_INFO; int verbose_logging = false; int terse_logging = false; @@ -70,7 +70,7 @@ _stderr_log_with_level(const char *level_name, int level, const char *fmt, va_li /* * Store the requested level so that if there's a subsequent log_hint() or - * log_detail(), we can suppress that if appropriate. + * log_detail(), we can suppress that if --terse was specified, */ last_log_level = level; diff --git a/repmgr.conf.sample b/repmgr.conf.sample index 92c973af..07395c90 100644 --- a/repmgr.conf.sample +++ b/repmgr.conf.sample @@ -98,7 +98,7 @@ #log_facility=STDERR # Logging facility: possible values are STDERR, or for # syslog integration, one of LOCAL0, LOCAL1, ..., LOCAL7, USER -#log_file='' # stderr can be redirected to an arbitrary file +#log_file='' # STDERR can be redirected to an arbitrary file #log_status_interval=300 # interval (in seconds) for repmgrd to log a status message