Skip to content

Commit 4427c95

Browse files
committed
Low: build: define constant for log directory
This defines CRM_LOG_DIR for (by default) /var/log/pacemaker. This will be used as the location for container logs, and (when we are ready to make a significant user-visible change) eventually for the main pacemaker log.
1 parent 4b08e8f commit 4427c95

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

configure.ac

+4
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,10 @@ CRM_STATE_DIR=${localstatedir}/run/crm
10761076
AC_DEFINE_UNQUOTED(CRM_STATE_DIR,"$CRM_STATE_DIR", Where to keep state files and sockets)
10771077
AC_SUBST(CRM_STATE_DIR)
10781078

1079+
CRM_LOG_DIR="${localstatedir}/log/pacemaker"
1080+
AC_DEFINE_UNQUOTED(CRM_LOG_DIR,"$CRM_LOG_DIR", Where Pacemaker can store log files)
1081+
AC_SUBST(CRM_LOG_DIR)
1082+
10791083
CRM_PACEMAKER_DIR=${localstatedir}/lib/pacemaker
10801084
AC_DEFINE_UNQUOTED(CRM_PACEMAKER_DIR,"$CRM_PACEMAKER_DIR", Location to store directory produced by Pacemaker daemons)
10811085
AC_SUBST(CRM_PACEMAKER_DIR)

include/crm_config.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343

4444
/****** Directories ******/
4545

46+
/* Where Pacemaker can store log files */
47+
#undef CRM_LOG_DIR
48+
4649
/* Location for Pacemaker daemons */
4750
#undef CRM_DAEMON_DIR
4851

lib/common/logging.c

+4
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ crm_add_logfile(const char *filename)
223223
bool is_default = false;
224224
static int default_fd = -1;
225225
static gboolean have_logfile = FALSE;
226+
227+
/* @COMPAT This should be CRM_LOG_DIR "/pacemaker.log". We aren't changing
228+
* it yet because it will be a significant user-visible change to publicize.
229+
*/
226230
const char *default_logfile = "/var/log/pacemaker.log";
227231

228232
struct stat parent;

mcp/corosync.c

+7
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,13 @@ mcp_read_config(void)
394394
free(debug_enabled);
395395
}
396396

397+
/* If the user didn't explicitly configure a Pacemaker log file, check
398+
* whether they configured a heartbeat or corosync log file, and use that.
399+
*
400+
* @COMPAT This should all go away, and we should just rely on the logging
401+
* set up by crm_log_init(). We aren't doing this yet because it is a
402+
* significant user-visible change that will need to be publicized.
403+
*/
397404
const_value = daemon_option("debugfile");
398405
if (daemon_option("logfile")) {
399406
/* File logging is already setup by crm_log_init() */

0 commit comments

Comments
 (0)