From c94063f4e60d3f1cee1cce03736962c097550ae3 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Thu, 30 May 2019 04:38:29 -0500 Subject: [PATCH] Fix: libcrmcommon: export logfile environment variable if using default When not explicitly specifying a log, Pacemaker before 2.0.0 would set the logfile environment variables when checking the corosync configuration for logging options. Since Pacemaker 2 does not use corosync's logging options anymore, this step was skipped. However, some resource agents relied on the environment variables to enable logging, so this introduced a regression. This fixes it by exporting the default log name when (successfully) used. --- lib/common/logging.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/common/logging.c b/lib/common/logging.c index 60745977ba5..674a4b8c273 100644 --- a/lib/common/logging.c +++ b/lib/common/logging.c @@ -334,6 +334,11 @@ crm_add_logfile(const char *filename) if(is_default) { default_fd = fd; + // Some resource agents will log only if environment variable is set + if (daemon_option("logfile") == NULL) { + set_daemon_option("logfile", filename); + } + } else if(default_fd >= 0) { crm_notice("Switching to %s", filename); qb_log_ctl(default_fd, QB_LOG_CONF_ENABLED, QB_FALSE);