public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* master - rgmanager: First pass at port to logsys
@ 2008-09-26 18:39 Lon Hohberger
  0 siblings, 0 replies; only message in thread
From: Lon Hohberger @ 2008-09-26 18:39 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=8203bea050c0d510f4a7671184a20a549e399c5d
Commit:        8203bea050c0d510f4a7671184a20a549e399c5d
Parent:        1f7b30389640dd45b122de1c7f460c7e6fdf24e5
Author:        Lon Hohberger <lhh@redhat.com>
AuthorDate:    Wed Sep 24 16:15:19 2008 -0400
Committer:     Lon Hohberger <lhh@redhat.com>
CommitterDate: Fri Sep 26 14:38:04 2008 -0400

rgmanager: First pass at port to logsys

logging.c is from group/*_controld with a few mods
clulog (command line utility) is not done yet.
---
 rgmanager/include/clulog.h           |  139 -----------------
 rgmanager/include/logging.h          |   10 ++
 rgmanager/include/resgroup.h         |    4 +-
 rgmanager/src/clulib/Makefile        |    4 +-
 rgmanager/src/clulib/clulog.c        |  281 ----------------------------------
 rgmanager/src/clulib/logging.c       |  225 +++++++++++++++++++++++++++
 rgmanager/src/clulib/msg_cluster.c   |    6 +-
 rgmanager/src/daemons/Makefile       |   16 +-
 rgmanager/src/daemons/clurmtabd.c    |   52 +++---
 rgmanager/src/daemons/depends.c      |   14 +--
 rgmanager/src/daemons/event_config.c |   18 +--
 rgmanager/src/daemons/fo_domain.c    |   90 +++++-------
 rgmanager/src/daemons/groups.c       |  104 +++++++-------
 rgmanager/src/daemons/main.c         |  120 +++++++--------
 rgmanager/src/daemons/reslist.c      |    7 +-
 rgmanager/src/daemons/resrules.c     |    6 +-
 rgmanager/src/daemons/restree.c      |   11 +-
 rgmanager/src/daemons/rg_event.c     |   40 +++---
 rgmanager/src/daemons/rg_forward.c   |   26 ++--
 rgmanager/src/daemons/rg_state.c     |  185 +++++++++++-----------
 rgmanager/src/daemons/rg_thread.c    |   12 +-
 rgmanager/src/daemons/service_op.c   |   16 +-
 rgmanager/src/daemons/slang_event.c  |   32 ++--
 rgmanager/src/daemons/test.c         |    1 +
 rgmanager/src/daemons/watchdog.c     |    8 +-
 rgmanager/src/utils/Makefile         |    4 +-
 rgmanager/src/utils/clubufflush.c    |   12 +-
 rgmanager/src/utils/clulog.c         |   39 +-----
 rgmanager/src/utils/clunfsops.c      |   18 +-
 29 files changed, 619 insertions(+), 881 deletions(-)

diff --git a/rgmanager/include/clulog.h b/rgmanager/include/clulog.h
deleted file mode 100644
index 01ee0e4..0000000
--- a/rgmanager/include/clulog.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/** @file
- * Header for clulog.c
- */
-
-#ifndef __CLUSTER_LOG_H
-#define __CLUSTER_LOG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <syslog.h>
-#include <sys/types.h>
-
-#define LOGLEVEL_DFLT         LOG_NOTICE
-#define MAX_LOGMSG_LEN        512
-
-/*
- * int clu_set_loglevel(int severity)
- *
- * DESCRIPTION
- *   Set the logging level for this daemon.  This is not a 
- *   system-wide setting.
- *
- * ARGUMENTS
- *   severity  Severity as documented in sys/syslog.h (i.e. LOG_ERR)
- *
- * RETURN VALUES
- *   On success, the previous loglevel is returned.  On error -1 is returned.
- *
- * NOTES
- *   The only way of generating errors for this call is to give a negative
- *   value for severity.  Currently, syslog lists severities up to 8, but
- *   I see no reason for this restriction if, in the future, we decided to
- *   add more levels.  Thus, any number up to MAXINT will be supported.
- */
-int clu_set_loglevel(int severity);
-int clu_set_facility(char *facility);
-int clu_log_console(int onoff);
-
-/*
- * int clu_get_loglevel(void)
- *
- * DESCRIPTION
- *   Get the current logging level.
- *
- * ARGUMENTS
- *   none
- *
- * RETURN VALUES
- *   The current logging level is returned.
- */
-int clu_get_loglevel(void);
-
-/*
- * DESCRIPTION
- *   Cluster logging facility.  This is the actual function that does the
- *   logging.  No one should call this, you should call the wrappers provided.
- *   i.e. clulog and clulog_and_print.
- */
-int do_clulog(int severity, int write_to_cons, pid_t pid,
-	      char *prog, const char *fmt, ...);
-/*
- * int clulog(int severity, const char *fmt, ...)
- *
- * DESCRIPTION
- *   Cluster logging facility.  This is a library routine which sends the 
- *   supplied parameters to the syslog daemon.  If the supplied severity is 
- *   numerically larger than the current loglevel, the message is never sent 
- *   to the log.
- *
- * ARGUMENTS
- *   severity  Severity as documented in sys/syslog.h (i.e. LOG_ERR)
- *   fmt       Format string as used with printf.
- *
- * RETURN VALUES
- *   On success, 0 is returned.  On error, -1 is returned.
- *
- * NOTES
- *   Inability to contact the logging daemon is the only source of error
- *   for this function.  Thus, it would behoove you to try a clulog before
- *   daemonizing your process.  If it fails, print a message to stderr
- *   explaining that the cluster logging daemon should probably be started.
- *   If you really want your message to be heard by someone, use
- *   clulog_and_print().
- */
-#define clulog(x,fmt,args...)              do_clulog(x,0,0,NULL,fmt,##args)
-#define clulog_pid(x,pid,prog,fmt,args...) do_clulog(x,0,pid,prog,fmt,##args)
-
-/*
- * int clulog_and_print(int severity, int write_to_cons, const char *fmt, ...)
- *
- * DESCRIPTION
- *   Cluster logging facility.  This is a library routine which sends the 
- *   supplied parameters to the syslog daemon.  If the supplied severity is 
- *   numerically larger than the current loglevel, the message is never sent 
- *   to the log.  This version also prints the given message to the terminal.
- *
- * ARGUMENTS
- *   severity       Severity as documented in sys/syslog.h (i.e. LOG_ERR)
- *   fmt            Format string as used with printf.
- *
- * RETURN VALUES
- *   On success, 0 is returned.  On error, -1 is returned.
- */
-#define clulog_and_print(x,fmt,args...)   do_clulog(x,1,0,NULL,fmt,##args)
-
-
-/*
- * void clulog_close(void)
- *
- * DESCRIPTION
- *   This is an optional call to close the logfile.  This translates into a
- *   closelog() call.
- *
- * ARGUMENTS
- *   none
- *
- * RETURN VALUES
- *   This function does not return anything.
- */
-void clulog_close(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif				/* __CLUSTER_LOG_H */
-/*
- * Local variables:
- *  c-basic-offset: 8
- *  c-indent-level: 8
- *  tab-width: 8
- * End:
- */
diff --git a/rgmanager/include/logging.h b/rgmanager/include/logging.h
new file mode 100644
index 0000000..cce6569
--- /dev/null
+++ b/rgmanager/include/logging.h
@@ -0,0 +1,10 @@
+#ifndef _LOGGING_H
+#define _LOGGING_H
+
+#include <corosync/engine/logsys.h>
+
+void init_logging(void);
+void setup_logging(int ccs_handle);
+void close_logging(void);
+
+#endif
diff --git a/rgmanager/include/resgroup.h b/rgmanager/include/resgroup.h
index 915925d..c5189c9 100644
--- a/rgmanager/include/resgroup.h
+++ b/rgmanager/include/resgroup.h
@@ -248,7 +248,7 @@ const char *rg_strerror(int val);
 //#define DEBUG
 #ifdef DEBUG
 
-#define dprintf(fmt, args...) \
+#define dbg_printf(fmt, args...) \
 {\
 	printf("{%d} ", gettid());\
 	printf(fmt, ##args);\
@@ -274,7 +274,7 @@ const char *rg_strerror(int val);
 
 #else /* DEBUG */
 
-#define dprintf(fmt, args...)
+#define dbg_printf(fmt, args...)
 
 #endif
 
diff --git a/rgmanager/src/clulib/Makefile b/rgmanager/src/clulib/Makefile
index 1849536..980a066 100644
--- a/rgmanager/src/clulib/Makefile
+++ b/rgmanager/src/clulib/Makefile
@@ -10,7 +10,7 @@ include $(OBJDIR)/make/clean.mk
 include $(OBJDIR)/make/install.mk
 include $(OBJDIR)/make/uninstall.mk
 
-OBJS1=	clulog.o daemon_init.o signals.o msgsimple.o \
+OBJS1=	logging.o daemon_init.o signals.o msgsimple.o \
 	gettid.o rg_strings.o message.o members.o fdops.o \
 	lock.o cman.o vft.o msg_cluster.o msg_socket.o \
 	wrap_lock.o sets.o
@@ -26,7 +26,7 @@ CFLAGS += -I${incdir}
 
 LDFLAGS += -L${cmanlibdir} -lcman 
 LDFLAGS += -L. -lclulib -llalloc
-LDFLAGS += -lpthread
+LDFLAGS += -lpthread -llogsys
 LDFLAGS += -L${libdir}
 
 ${TARGET1}: ${OBJS1}
diff --git a/rgmanager/src/clulib/clulog.c b/rgmanager/src/clulib/clulog.c
deleted file mode 100644
index 4cb8e1a..0000000
--- a/rgmanager/src/clulib/clulog.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/** @file
- * Library routines for communicating with the logging daemon.
- *
- *  $Id$
- *
- *  Author: Jeff Moyer <moyer@missioncriticallinux.com>
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <malloc.h>
-#include <dirent.h>
-#include <signal.h>
-#include <sys/errno.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/socket.h>
-#define SYSLOG_NAMES
-#include <sys/syslog.h>
-#undef SYSLOG_NAMES
-
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <linux/unistd.h>
-#include <pthread.h>
-#include <gettid.h>
-#include <clulog.h>
-#include <string.h>
-
-
-static const char *version __attribute__ ((unused)) = "$Revision$";
-
-#ifdef DEBUG
-#include <assert.h>
-#define Dprintf(fmt,args...) printf(fmt,##args)
-#define DBG_ASSERT(x)  assert(x)
-#else
-#define Dprintf(fmt,args...)
-#define DBG_ASSERT(x)
-#endif
-
-/*
- * Globals
- */
-static int   log_is_open = 0;
-static int   useconsole = 0;
-static int   loglevel = LOGLEVEL_DFLT;
-static int   syslog_facility = LOG_DAEMON;
-static char  *daemon_name = NULL;
-static pid_t daemon_pid = -1;
-
-#ifdef WRAP_LOCKS
-static pthread_mutex_t log_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-#else
-static pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif
-
-CODE logger_prioritynames[] = 
-{ {"emerg", LOG_EMERG},
-  {"alert", LOG_ALERT},
-  {"crit", LOG_CRIT},
-  {"err", LOG_ERR},
-  {"warning", LOG_WARNING},
-  {"notice", LOG_NOTICE},
-  {"info", LOG_INFO},
-  {"debug", LOG_DEBUG}
-};
-
-/*
- *  Exported Functions.
- */
-
-/**
- * @return The current cluster log level.
- */
-int
-clu_get_loglevel(void)
-{
-	return loglevel;
-}
-
-
-/**
- * Set the cluster log level.
- *
- * @param severity	New log level.
- * @return 		Old log level, or -1 if 'severity' is an invalid log
- *			level.
- */
-int
-clu_set_loglevel(int severity)
-{
-	int ret = loglevel;
-
-	if (severity > 0) {
-		loglevel = severity;
-		return ret;
-	}
-
-	return -1;
-}
-
-
-/**
- * @return The current cluster log facility.
- */
-char *
-clu_get_facility(void)
-{
-	int x = 0;
-
-	pthread_mutex_lock(&log_mutex);
-	for (; facilitynames[x].c_name; x++) {
-		if (syslog_facility == facilitynames[x].c_val) {
-			pthread_mutex_unlock(&log_mutex);
-			return facilitynames[x].c_name;
-		}
-	}
-	
-	pthread_mutex_unlock(&log_mutex);
-	return "local4";
-}
-
-
-/**
- * Set the cluster log facility.
- *
- * @param facilityname  New log facility (see /usr/include/sys/syslog.h).
- * @return 		0
- */
-int
-clu_set_facility(char *facilityname)
-{
-	int x = 0, old;
-
-	pthread_mutex_lock(&log_mutex);
-	old = syslog_facility;
-
-	for (; facilitynames[x].c_name; x++) {
-		if (strcmp(facilityname, facilitynames[x].c_name))
-			continue;
-
-		syslog_facility = facilitynames[x].c_val;
-		break;
-	}
-
-	if (syslog_facility == old) {
-		pthread_mutex_unlock(&log_mutex);
-		return 0;
-	}
-
-	closelog();
-	log_is_open = 0;
-	pthread_mutex_unlock(&log_mutex);
-	return 0;
-}
-
-
-/**
- * Set the console logging mode.  Does not work for daemons.
- *
- * @param onoff		0 = off, otherwise on.
- * @return		Old log-to-console state.
- */
-int
-clu_log_console(int onoff)
-{
-	int ret = useconsole;
-
-	useconsole = !!onoff;
-	return ret;
-}
-
-
-/**
- * Cluster logging function.  Talks to syslog and writes to the
- * console, if necessary.
- */
-int
-do_clulog(int        severity,
-	  int        write_to_cons,
-	  pid_t      pid,
-	  char       *prog,
-	  const char *fmt, ...)
-{
-	va_list      args;
-	char         logmsg[MAX_LOGMSG_LEN];	/* message to go to the log */
-	char         printmsg[MAX_LOGMSG_LEN];	/* message to go to stdout */
-	int          syslog_flags = LOG_NDELAY;
-
-	pthread_mutex_lock(&log_mutex);
-	if (severity > loglevel) {
-		pthread_mutex_unlock(&log_mutex);
-		return 0;
-	}
-
-	memset(logmsg, 0, MAX_LOGMSG_LEN);
-	memset(printmsg, 0, MAX_LOGMSG_LEN);
-
-	/*
-	 * Check to see if the caller has forked.
-	 */
-	if (!pid) {
-
-		/* Use thread IDs */
-		if (daemon_pid != gettid()) {
-
-			daemon_pid = gettid();
-			log_is_open = 0;
-		}
-
-		syslog_flags |= LOG_PID;
-
-	} else {
-
-		daemon_pid = pid;
-		closelog();
-		log_is_open = 0;
-		snprintf(logmsg, MAX_LOGMSG_LEN, "[%d]: ", pid);
-	}
-
-	if (prog) {
-
-		if (daemon_name) {
-
-			free(daemon_name);
-			daemon_name = NULL;
-		}
-
-		daemon_name = strdup(prog);
-	}
-
-	if (!log_is_open) {
-
-		openlog(daemon_name, syslog_flags, syslog_facility);
-		log_is_open = 1;
-	}
-	/*
-	 * Note: This can be called in the context of a CGI program, in which
-	 * case anything printed to stdout goes to the web page.  This can
-	 * cause problems if we have our standard <warning> strings b/c
-	 * the web client will try to interpret this as an html tag.
-	 */
-	snprintf(logmsg + strlen(logmsg), MAX_LOGMSG_LEN - strlen(logmsg), 
-		 "<%s> ", logger_prioritynames[severity].c_name);
-
-	va_start(args, fmt);
-	vsnprintf(logmsg + strlen(logmsg), MAX_LOGMSG_LEN - strlen(logmsg), 
-		  fmt, args);
-	va_end(args);
-
-	if (write_to_cons || useconsole) {
-		snprintf(printmsg, MAX_LOGMSG_LEN, "[%d] %s: ", daemon_pid,
-			 logger_prioritynames[severity].c_name);
-
-		va_start(args, fmt);
-		vsnprintf(printmsg + strlen(printmsg),
-			  MAX_LOGMSG_LEN - strlen(printmsg), fmt, args);
-		va_end(args);
-
-		fprintf(stdout, "%s", printmsg);
-	}
-
-	syslog(severity, "%s", logmsg);
-
-	pthread_mutex_unlock(&log_mutex);
-
-	return 0;
-}
-
-
-/**
- * Stop the cluster logging facility.
- */
-void
-clulog_close(void)
-{
-	closelog();
-}
diff --git a/rgmanager/src/clulib/logging.c b/rgmanager/src/clulib/logging.c
new file mode 100644
index 0000000..eba6d82
--- /dev/null
+++ b/rgmanager/src/clulib/logging.c
@@ -0,0 +1,225 @@
+#include <stdlib.h>
+#include <logging.h>
+#include <unistd.h>
+#include <string.h>
+#include <limits.h>
+#include <malloc.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <ccs.h>
+
+#define DAEMON_NAME "rgmanager"
+
+/* default: errors go to syslog (/var/log/messages) and <daemon>.log
+   logging/debug=on: errors continue going to syslog (/var/log/messages)
+   and <daemon>.log, debug messages are added to <daemon>.log. */
+
+#define DEFAULT_MODE		LOG_MODE_OUTPUT_SYSLOG_THREADED | \
+				LOG_MODE_OUTPUT_FILE | \
+				LOG_MODE_NOSUBSYS | \
+				LOG_MODE_FILTER_DEBUG_FROM_SYSLOG
+#define DEFAULT_FACILITY	SYSLOGFACILITY /* cluster config setting */
+#define DEFAULT_PRIORITY	SYSLOGLEVEL /* cluster config setting */
+#define DEFAULT_FILE		LOGDIR "/" DAEMON_NAME ".log"
+
+#define DAEMON_LEVEL_PATH "/cluster/logging/logger_subsys[@subsys=\"rgmanager\"]/@syslog_level"
+#define DAEMON_DEBUG_PATH "/cluster/logging/logger_subsys[@subsys=\"rgmanager\"]/@debug"
+
+/* Read cluster.conf settings and convert them into logsys values.
+   If no cluster.conf setting exists, the default that was used in
+   logsys_init() is used.
+
+   mode from
+   "/cluster/logging/@to_stderr"
+   "/cluster/logging/@to_syslog"
+   "/cluster/logging/@to_file"
+
+   facility from
+   "/cluster/logging/@syslog_facility"
+
+   priority from
+   "/cluster/logging/logger_subsys[@subsys=\"prog_name\"]/@syslog_level"
+
+   file from
+   "/cluster/logging/@logfile"
+
+   debug from
+   "/cluster/logging/@debug"
+   "/cluster/logging/logger_subsys[@subsys=\"prog_name\"]/@debug"
+*/
+static void
+read_ccs_name(int ccs_handle, char *path, char *name, size_t max)
+{
+	char *str;
+	int error;
+
+	name[max-1] = 0;
+
+	error = ccs_get(ccs_handle, path, &str);
+	if (error || !str)
+		return;
+
+	strncpy(name, str, max-1);
+
+	free(str);
+}
+
+
+static int
+read_ccs_yesno(int ccs_handle, char *path)
+{
+	char *str = NULL;
+	int error;
+	int ret = -1;
+
+	error = ccs_get(ccs_handle, path, &str);
+	if (error)
+		goto out;
+
+	if ((!strcasecmp(str, "yes")) ||
+	    (!strcasecmp(str, "true")) ||
+	    (atoi(str) > 0)) {
+		ret = 1;
+	}
+
+	if ((!strcasecmp(str, "no")) ||
+	    (!strcasecmp(str, "false")) ||
+	    (atoi(str) == 0)) {
+		ret = 0;
+	}
+
+out:
+	if (str) 
+		free(str);
+	return ret;
+}
+
+
+static int
+read_ccs_logging(int ccs_handle, int *mode, int *facility, int *priority,
+		 char *file)
+{
+	int val;
+	int m = 0, f = 0, p = 0;
+	char name[PATH_MAX];
+
+	/*
+	 * mode
+	 */
+
+	m = DEFAULT_MODE;
+	val = read_ccs_yesno(ccs_handle, "/cluster/logging/@to_stderr");
+	if (val == 1)
+		m |= LOG_MODE_OUTPUT_STDERR;
+	else if (val == 0)
+		m &= ~LOG_MODE_OUTPUT_STDERR;
+
+	val = read_ccs_yesno(ccs_handle, "/cluster/logging/@to_stderr");
+	if (val == 1)
+		m |= LOG_MODE_OUTPUT_SYSLOG_THREADED;
+	else if (val == 0)
+		m &= ~LOG_MODE_OUTPUT_SYSLOG_THREADED;
+
+	val = read_ccs_yesno(ccs_handle, "/cluster/logging/@to_file");
+	if (val == 1)
+		m |= LOG_MODE_OUTPUT_FILE;
+	else if (val == 0)
+		m &= ~LOG_MODE_OUTPUT_FILE;
+
+	*mode = m;
+
+	/*
+	 * facility
+	 */
+
+	f = DEFAULT_FACILITY;
+
+	memset(name, 0, sizeof(name));
+	read_ccs_name(ccs_handle, "/cluster/logging/@syslog_facility", name, sizeof(name));
+
+	if (name[0]) {
+		val = logsys_facility_id_get(name);
+		if (val >= 0)
+			f = val;
+	}
+
+	*facility = f;
+
+	/*
+	 * priority
+	 */
+
+	p = DEFAULT_PRIORITY;
+
+	memset(name, 0, sizeof(name));
+	read_ccs_name(ccs_handle, DAEMON_LEVEL_PATH, name, sizeof(name));
+
+	if (name[0]) {
+		val = logsys_priority_id_get(name);
+		if (val >= 0)
+			p = val;
+	}
+
+	*priority = p;
+
+	/*
+	 * file
+	 */
+
+	strcpy(file, DEFAULT_FILE);
+
+	memset(name, 0, sizeof(name));
+	read_ccs_name(ccs_handle, "/cluster/logging/@logfile", name, sizeof(name));
+
+	if (name[0])
+		strcpy(file, name);
+
+	/*
+	 * debug
+	 */
+	memset(name, 0, sizeof(name));
+	read_ccs_name(ccs_handle, "/cluster/logging/@debug", name, sizeof(name));
+
+#if 0
+	if (!strcmp(name, "on"))
+		cfgd_debug_logsys = 1;
+
+	memset(name, 0, sizeof(name));
+	read_ccs_name(ccs_handle, DAEMON_DEBUG_PATH, name);
+
+	if (!strcmp(name, "on"))
+		cfgd_debug_logsys = 1;
+	else if (!strcmp(name, "off"))
+		cfgd_debug_logsys = 0;
+#endif
+	return 0;
+}
+
+/* initial settings until we can read cluster.conf logging settings from ccs */
+
+void
+init_logging(void)
+{
+	logsys_init(DAEMON_NAME, DEFAULT_MODE, DEFAULT_FACILITY,
+		    DEFAULT_PRIORITY, DEFAULT_FILE);
+}
+
+/* this function is also called when we get a cman config-update event */
+void
+setup_logging(int ccs_handle)
+{
+	int mode, facility, priority;
+	char file[PATH_MAX];
+
+	memset(file, 0, PATH_MAX);
+
+	read_ccs_logging(ccs_handle, &mode, &facility, &priority, file);
+	logsys_conf(DAEMON_NAME, mode, facility, priority, file);
+}
+
+void
+close_logging(void)
+{
+	logsys_exit();
+}
+
diff --git a/rgmanager/src/clulib/msg_cluster.c b/rgmanager/src/clulib/msg_cluster.c
index a5ffb66..3292037 100644
--- a/rgmanager/src/clulib/msg_cluster.c
+++ b/rgmanager/src/clulib/msg_cluster.c
@@ -15,7 +15,7 @@
 #include <signals.h>
 #include <gettid.h>
 #include <cman-private.h>
-#include <clulog.h>
+#include <logging.h>
 
 /* Ripped from ccsd's setup_local_socket */
 
@@ -709,7 +709,7 @@ queue_for_context(msgctx_t *ctx, char *buf, int len)
 	msg_q_t *node;
 
 	if (ctx->type != MSG_CLUSTER) {
-		clulog(LOG_WARNING, "%s called on invalid context %p\n",
+		log_printf(LOG_WARNING, "%s called on invalid context %p\n",
 		       __FUNCTION__, ctx);
 		return;
 	}
@@ -828,7 +828,7 @@ process_cman_msg(cman_handle_t h, void *priv, char *buf, int len,
 		    contexts[m->dest_ctx]->type != MSG_CLUSTER) {
 			/* XXX Work around bug where M_CLOSE is called
 			   on a context which has been destroyed */
-			clulog(LOG_WARNING, "Ignoring M_CLOSE for destroyed "
+			log_printf(LOG_WARNING, "Ignoring M_CLOSE for destroyed "
 			       "context %d\n", m->dest_ctx);
 		} else {
 			queue_for_context(contexts[m->dest_ctx], buf, len);
diff --git a/rgmanager/src/daemons/Makefile b/rgmanager/src/daemons/Makefile
index 876ef70..c30fe5f 100644
--- a/rgmanager/src/daemons/Makefile
+++ b/rgmanager/src/daemons/Makefile
@@ -1,11 +1,11 @@
-TARGET1= clurgmgrd
-TARGET2= clurmtabd
+TARGET1= rgmanager
+#TARGET2= clurmtabd  # Not needed on 2.6 kernels
 TARGET3= rg_test
 TARGET4= dtest
 
-SBINDIRT=$(TARGET1) $(TARGET2) $(TARGET3)
+SBINDIRT=$(TARGET1) $(TARGET3)
 
-all: depends ${TARGET1} ${TARGET2} ${TARGET3}
+all: depends ${TARGET1} ${TARGET3}
 
 include ../../../make/defines.mk
 include $(OBJDIR)/make/cobj.mk
@@ -48,7 +48,7 @@ SHAREDOBJS=	depends-noccs.o \
 		rg_locks-noccs.o \
 		event_config-noccs.o
 
-CFLAGS += -D_GNU_SOURCE -DSHAREDIR=\"${sharedir}\"
+CFLAGS += -DSHAREDIR=\"${sharedir}\"
 CFLAGS += -Werror -Wstrict-prototypes -Wshadow -fPIC
 CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${dlmincdir}
 CFLAGS += `xml2-config --cflags` -I${readlineincdir} -I${slangincdir}
@@ -61,7 +61,7 @@ LDFLAGS += -L../clulib -lclulib
 LDFLAGS += -L${libdir}
 
 CCS_LDFLAGS += -L${ccslibdir} -lccs 
-CMAN_LDFLAGS += -L${cmanlibdir} -lcman
+CMAN_LDFLAGS += -L${cmanlibdir} -lcman -llogsys
 DLM_LDFLAGS += -L${dlmlibdir} -ldlm
 XML2_LDFLAGS += `xml2-config --libs`
 SLANG_LDFLAGS += -L${slanglibdir} -lslang
@@ -79,8 +79,8 @@ ${TARGET1}: ${OBJS1} ${LDDEPS}
 			$(SLANG_LDFLAGS) $(EXTRA_LDFLAGS) \
 			$(LD_FLAGS)
 
-${TARGET2}: ${OBJS2} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
+#${TARGET2}: ${OBJS2} ${LDDEPS}
+#	$(CC) -o $@ $^ $(LDFLAGS)
 
 #
 # Our test program links against the local allocator so that
diff --git a/rgmanager/src/daemons/clurmtabd.c b/rgmanager/src/daemons/clurmtabd.c
index 46a79ca..9dbb045 100644
--- a/rgmanager/src/daemons/clurmtabd.c
+++ b/rgmanager/src/daemons/clurmtabd.c
@@ -16,7 +16,7 @@
 #include <signal.h>
 #include <errno.h>
 #include <syslog.h>
-#include <clulog.h>
+#include <logging.h>
 #include <unistd.h>
 #include <limits.h>
 #include <regex.h>
@@ -90,20 +90,20 @@ rmtab_modified(void)
 	memset(&curr_stat, 0, sizeof (curr_stat));
 	while (stat(_PATH_RMTAB, &curr_stat) == -1) {
 		if (errno != ENOENT) {
-			clulog(LOG_ERR, "#15: %s: stat: %s\n", __FUNCTION__,
+			log_printf(LOG_ERR, "#15: %s: stat: %s\n", __FUNCTION__,
 			       strerror(errno));
 			return -1;
 		}
 
 		/* Create the file. */
-		clulog(LOG_WARNING, "#62: " _PATH_RMTAB
+		log_printf(LOG_WARNING, "#62: " _PATH_RMTAB
 		       " does not exist - creating");
 		close(open(_PATH_RMTAB, O_CREAT | O_SYNC, 0600));
 	}
 
 	if ((rv = memcmp(&prev_stat.st_mtime, &curr_stat.st_mtime,
 			 sizeof (curr_stat.st_mtime)))) {
-		clulog(LOG_DEBUG, "Detected modified " _PATH_RMTAB "\n");
+		log_printf(LOG_DEBUG, "Detected modified " _PATH_RMTAB "\n");
 		memcpy(&prev_stat, &curr_stat, sizeof (prev_stat));
 	}
 
@@ -165,7 +165,7 @@ rmtab_get_update(rmtab_node ** rmtab, rmtab_node ** pruned_rmtab,
 	rmtab_move(&old_rmtab, rmtab);
 
 	if (rmtab_read(rmtab, _PATH_RMTAB) == -1) {
-		clulog(LOG_ERR, "#16: Failed to reread rmtab: %s\n",
+		log_printf(LOG_ERR, "#16: Failed to reread rmtab: %s\n",
 		       strerror(errno));
 
 		/* Don't kill the list if we fail to reread. */
@@ -177,7 +177,7 @@ rmtab_get_update(rmtab_node ** rmtab, rmtab_node ** pruned_rmtab,
 	rmtab_move(&old_pruned, pruned_rmtab);
 
 	if (rmtab_copy_bypath(pruned_rmtab, rmtab, path) == -1) {
-		clulog(LOG_ERR, "#17: Failed to prune rmtab: %s\n",
+		log_printf(LOG_ERR, "#17: Failed to prune rmtab: %s\n",
 		       strerror(errno));
 
 		/* 
@@ -196,7 +196,7 @@ rmtab_get_update(rmtab_node ** rmtab, rmtab_node ** pruned_rmtab,
 
 	/* find the differences */
 	if (rmtab_diff(old_pruned, *pruned_rmtab, diff)) {
-		clulog(LOG_ERR, "Failed to diff rmtab: %s\n", strerror(errno));
+		log_printf(LOG_ERR, "Failed to diff rmtab: %s\n", strerror(errno));
 		goto out;
 	}
 
@@ -239,7 +239,7 @@ rmtab_get_update(rmtab_node ** rmtab, rmtab_node ** pruned_rmtab,
 static void
 sh_sync(int sig)
 {
-	clulog(LOG_DEBUG, "Signal %d received; syncing ASAP\n", sig);
+	log_printf(LOG_DEBUG, "Signal %d received; syncing ASAP\n", sig);
 }
 
 
@@ -253,7 +253,7 @@ sh_sync(int sig)
 static void
 sh_exit(int sig)       
 {
-	clulog(LOG_DEBUG, "Signal %d received; exiting\n", sig);
+	log_printf(LOG_DEBUG, "Signal %d received; exiting\n", sig);
 	exiting = 1;
 }
 
@@ -266,7 +266,7 @@ sh_exit(int sig)
 static void
 sh_reconfigure(int __attribute__ ((unused)) sig)
 {
-	clulog(LOG_DEBUG, "Re-reading the cluster database\n");
+	log_printf(LOG_DEBUG, "Re-reading the cluster database\n");
 	rmtabd_reconfigure();
 }
 
@@ -346,7 +346,7 @@ __get_int_param(char *str, int *val, int dflt)
 		*val = atoi(value);
 		break;
 	default:
-		clulog(LOG_ERR, "#19: Cannot get \"%s\" from database; "
+		log_printf(LOG_ERR, "#19: Cannot get \"%s\" from database; "
 		       "CFG_Get() failed, err=%d\n", ret);
 		return 0;
 	}
@@ -398,9 +398,9 @@ rmtabd_reconfigure(void)
 
 	if (old_level != level) {
 		if (clu_set_loglevel(level) == -1)
-			clulog(LOG_ERR, "#20: Failed set log level\n");
+			log_printf(LOG_ERR, "#20: Failed set log level\n");
 		else
-			clulog(LOG_DEBUG, "Log level is now %d\n", level);
+			log_printf(LOG_DEBUG, "Log level is now %d\n", level);
 	}
 
 	/* rmtabd polling interval (tw33k4bl3) */
@@ -414,7 +414,7 @@ rmtabd_reconfigure(void)
 		poll_interval = 10;
 
 	if (old_interval != poll_interval) {
-		clulog_and_print(LOG_DEBUG,
+		log_printf_and_print(LOG_DEBUG,
 				 "Polling interval is now %d seconds\n",
 				 poll_interval);
 	}
@@ -455,7 +455,7 @@ rmtab_init(char *path, rmtab_node **rmtab, rmtab_node **pruned_rmtab)
 	snprintf(buf, sizeof(buf), "%s/%s", path, CM_NFS_DIR);
 
 	if ((mkdir(buf, 0700) == -1) && (errno != EEXIST)) {
-		clulog_and_print(LOG_ERR, "#21: Couldn't read/create %s: %s\n",
+		log_printf_and_print(LOG_ERR, "#21: Couldn't read/create %s: %s\n",
 				 buf, strerror(errno));
 		return -1;
 	}
@@ -463,7 +463,7 @@ rmtab_init(char *path, rmtab_node **rmtab, rmtab_node **pruned_rmtab)
 	snprintf(buf, sizeof(buf), "%s/%s/rmtab", path, CM_NFS_DIR);
 
 	if (rmtab_read(rmtab, buf) == -1) {
-		clulog_and_print(LOG_ERR, "#22: Failed to read %s: %s\n", buf,
+		log_printf_and_print(LOG_ERR, "#22: Failed to read %s: %s\n", buf,
 				 strerror(errno));
 		return -1;
 	}
@@ -473,7 +473,7 @@ rmtab_init(char *path, rmtab_node **rmtab, rmtab_node **pruned_rmtab)
 	 * cause the nodes with the greater count to be kept.
 	 */
 	if (rmtab_read(rmtab, _PATH_RMTAB) == -1) {
-		clulog_and_print(LOG_ERR, "#23: Failed to read %s: %s\n",
+		log_printf_and_print(LOG_ERR, "#23: Failed to read %s: %s\n",
 				 _PATH_RMTAB, strerror(errno));
 		return -1;
 	}
@@ -482,7 +482,7 @@ rmtab_init(char *path, rmtab_node **rmtab, rmtab_node **pruned_rmtab)
 	 * Prune by our path
 	 */
 	if (rmtab_copy_bypath(pruned_rmtab, rmtab, path) == -1) {
-		clulog_and_print(LOG_ERR, "#24: Failed to prune rmtab: %s\n",
+		log_printf_and_print(LOG_ERR, "#24: Failed to prune rmtab: %s\n",
 				 strerror(errno));
 		return -1;
 	}
@@ -492,7 +492,7 @@ rmtab_init(char *path, rmtab_node **rmtab, rmtab_node **pruned_rmtab)
 	 * we rewrite the file.
 	 */
 	if (rmtab_write_atomic(*rmtab, _PATH_RMTAB) == -1) {
-		clulog_and_print(LOG_ERR, "#25: Failed to write %s: %s\n",
+		log_printf_and_print(LOG_ERR, "#25: Failed to write %s: %s\n",
 				 _PATH_RMTAB, strerror(errno));
 		return -1;
 	}
@@ -500,7 +500,7 @@ rmtab_init(char *path, rmtab_node **rmtab, rmtab_node **pruned_rmtab)
 	 * Write new contents.
 	 */
 	if (rmtab_write_atomic(*pruned_rmtab, buf) == -1) {
-		clulog_and_print(LOG_ERR, "#26: Failed to write %s: %s\n", buf,
+		log_printf_and_print(LOG_ERR, "#26: Failed to write %s: %s\n", buf,
 				 strerror(errno));
 		return -1;
 	}
@@ -530,7 +530,7 @@ daemonize(char *path)
 
 	fp = fopen(filename, "w");
 	if (fp == NULL) {
-		clulog(LOG_WARNING, "#63: Couldn't write PID!\n");
+		log_printf(LOG_WARNING, "#63: Couldn't write PID!\n");
 	}
 
 	fprintf(fp, "%d", getpid());
@@ -560,7 +560,7 @@ main(int argc, char **argv)
 
 	/* Set up configuration parameters */
 	if (rmtabd_config_init() == -1) {
-		clulog_and_print(LOG_ERR,
+		log_printf_and_print(LOG_ERR,
 			         "#27: Couldn't initialize - exiting\n");
 		return -1;
 	}
@@ -578,9 +578,9 @@ main(int argc, char **argv)
 	 * all the necessary entries.
 	 */
 	if (rmtab_init(path, &rmtab, &pruned_rmtab) == -1) {
-		clulog_and_print(LOG_WARNING,
+		log_printf_and_print(LOG_WARNING,
 				 "#64: Could not validate %s\n", path);
-		clulog_and_print(LOG_WARNING,
+		log_printf_and_print(LOG_WARNING,
 				 "#65: NFS Failover of %s will malfunction\n",
 				 path);
 		return -1;
@@ -588,7 +588,7 @@ main(int argc, char **argv)
 
 	/* Jump off into the background */
 	if (daemonize(path) == -1) {
-		clulog_and_print(LOG_ERR, "#28: daemonize: %s\n",
+		log_printf_and_print(LOG_ERR, "#28: daemonize: %s\n",
 				 strerror(errno));
 		return -1;
 	}
@@ -606,7 +606,7 @@ main(int argc, char **argv)
 			rmtab_merge(&pruned_rmtab, diff);
 			rmtab_kill(&diff);
 			if (rmtab_write_atomic(pruned_rmtab, rmtab_priv) == -1)
-				clulog(LOG_ERR,
+				log_printf(LOG_ERR,
 				       "#29: rmtab_write_atomic: %s\n",
 				       strerror(errno));
 		}
diff --git a/rgmanager/src/daemons/depends.c b/rgmanager/src/daemons/depends.c
index f316f0d..d9dda8d 100644
--- a/rgmanager/src/daemons/depends.c
+++ b/rgmanager/src/daemons/depends.c
@@ -19,7 +19,7 @@
 #include <list.h>
 #include <time.h>
 #include <restart_counter.h>
-#include <clulog.h>
+#include <logging.h>
 #include <resgroup.h>
 #include <reslist.h>
 #include <ccs.h>
@@ -43,18 +43,6 @@ fod_t *fod_find_domain(fod_t **domains, char *name);
 
 //#define DEBUG
 
-#ifdef DEBUG
-#define ENTER() clulog(LOG_DEBUG, "ENTER: %s\n", __FUNCTION__)
-#define RETURN(val) {\
-	clulog(LOG_DEBUG, "RETURN: %s line=%d value=%d\n", __FUNCTION__, \
-	       __LINE__, (val));\
-	return(val);\
-}
-#else
-#define ENTER()
-#define RETURN(val) return(val)
-#endif
-
 #ifdef NO_CCS
 #define ccs_get(fd, query, ret) conf_get(query, ret)
 #endif
diff --git a/rgmanager/src/daemons/event_config.c b/rgmanager/src/daemons/event_config.c
index 514d68f..cd0afee 100644
--- a/rgmanager/src/daemons/event_config.c
+++ b/rgmanager/src/daemons/event_config.c
@@ -3,7 +3,7 @@
  */
 #include <string.h>
 #include <list.h>
-#include <clulog.h>
+#include <logging.h>
 #include <resgroup.h>
 #include <restart_counter.h>
 #include <reslist.h>
@@ -26,18 +26,6 @@ void print_event(event_t *ev);
 
 //#define DEBUG
 
-#ifdef DEBUG
-#define ENTER() clulog(LOG_DEBUG, "ENTER: %s\n", __FUNCTION__)
-#define RETURN(val) {\
-	clulog(LOG_DEBUG, "RETURN: %s line=%d value=%d\n", __FUNCTION__, \
-	       __LINE__, (val));\
-	return(val);\
-}
-#else
-#define ENTER()
-#define RETURN(val) return(val)
-#endif
-
 #ifdef NO_CCS
 #define ccs_get(fd, query, ret) conf_get(query, ret)
 #endif
@@ -347,7 +335,7 @@ get_event(int ccsfd, char *base, int idx, int *_done)
 	if (ccs_get(ccsfd, xpath, &ret) == 0) {
 		ev->ev_prio = atoi(ret);
 		if (ev->ev_prio <= 0 || ev->ev_prio > EVENT_PRIO_COUNT) {
-			clulog(LOG_ERR,
+			log_printf(LOG_ERR,
 			       "event %s: priority %s invalid\n",
 			       ev->ev_name, ret);
 			goto out_fail;
@@ -378,7 +366,7 @@ get_event(int ccsfd, char *base, int idx, int *_done)
 			if (get_config_event(ccsfd, xpath, ev) < 0)
 				goto out_fail;
 		} else {
-			clulog(LOG_ERR,
+			log_printf(LOG_ERR,
 			       "event %s: class %s unrecognized\n",
 			       ev->ev_name, ret);
 			goto out_fail;
diff --git a/rgmanager/src/daemons/fo_domain.c b/rgmanager/src/daemons/fo_domain.c
index 222a12d..f934e38 100644
--- a/rgmanager/src/daemons/fo_domain.c
+++ b/rgmanager/src/daemons/fo_domain.c
@@ -7,7 +7,7 @@
  */
 #include <string.h>
 #include <list.h>
-#include <clulog.h>
+#include <logging.h>
 #include <resgroup.h>
 #include <restart_counter.h>
 #include <reslist.h>
@@ -21,18 +21,6 @@
 
 //#define DEBUG
 
-#ifdef DEBUG
-#define ENTER() clulog(LOG_DEBUG, "ENTER: %s\n", __FUNCTION__)
-#define RETURN(val) {\
-	clulog(LOG_DEBUG, "RETURN: %s line=%d value=%d\n", __FUNCTION__, \
-	       __LINE__, (val));\
-	return(val);\
-}
-#else
-#define ENTER()
-#define RETURN(val) return(val)
-#endif
-
 #ifdef NO_CCS
 #define ccs_get(fd, query, ret) conf_get(query, ret)
 #endif
@@ -68,7 +56,7 @@ fod_get_node(int __attribute__((unused)) ccsfd, char *base, int idx, fod_t *doma
 		if (strcasecmp(ret, fodn->fdn_name))
 			continue;
 
-		clulog(LOG_ERR, "#30: Node %s defined multiple times in "
+		log_printf(LOG_ERR, "#30: Node %s defined multiple times in "
 		       "domain %s\n", ret, domain->fd_name);
 		free(ret);
 		return NULL;
@@ -87,7 +75,7 @@ fod_get_node(int __attribute__((unused)) ccsfd, char *base, int idx, fod_t *doma
  		 "/cluster/clusternodes/clusternode[@name=\"%s\"]/@nodeid",
  		 ret);
  	if (ccs_get(ccsfd, xpath, &ret) != 0) {
- 		clulog(LOG_WARNING, "Node %s has no nodeid attribute\n",
+ 		log_printf(LOG_WARNING, "Node %s has no nodeid attribute\n",
  		       fodn->fdn_name);
  		fodn->fdn_nodeid = -1;
  	} else {
@@ -132,7 +120,7 @@ fod_get_domain(int ccsfd, char *base, int idx, fod_t **domains)
 		if (strcasecmp(fod->fd_name, ret))
 			continue;
 		    
-		clulog(LOG_ERR, "#31: Domain %s defined multiple times\n",
+		log_printf(LOG_ERR, "#31: Domain %s defined multiple times\n",
 		       ret);
 		free(ret);
 		return NULL;
@@ -453,16 +441,14 @@ node_should_start(int nodeid, cluster_member_list_t *membership,
 	struct dlm_lksb lockp;
 #endif
 
-	ENTER();
-
 	/*
 	 * Um, if the node isn't online...
 	 */
 	if (!memb_online(membership, nodeid)) {
 #ifdef DEBUG
-		clulog(LOG_DEBUG,"Member #%d is not online -> NO\n", nodeid);
+		log_printf(LOG_DEBUG,"Member #%d is not online -> NO\n", nodeid);
 #endif
-		RETURN(FOD_ILLEGAL);
+		return FOD_ILLEGAL;
 	}
 
 	nodename = memb_id_to_name(membership, nodeid);
@@ -475,10 +461,10 @@ node_should_start(int nodeid, cluster_member_list_t *membership,
 		 * try to start the service.
 		 */
 #ifdef DEBUG
-		clulog(LOG_DEBUG,
+		log_printf(LOG_DEBUG,
 		       "Fail-over Domain for service %d nonexistent\n");
 #endif
-		RETURN(FOD_BEST);
+		return FOD_BEST;
 	}
 #endif
 
@@ -498,9 +484,9 @@ node_should_start(int nodeid, cluster_member_list_t *membership,
 		/*
 		 * Domain doesn't exist!  Weird...
 		 */
-		clulog(LOG_WARNING, "#66: Domain '%s' specified for resource "
+		log_printf(LOG_WARNING, "#66: Domain '%s' specified for resource "
 		       "group %s nonexistent!\n", domainname, rg_name);
-		RETURN(FOD_BEST);
+		return FOD_BEST;
 	}
 
 	/*
@@ -521,18 +507,18 @@ node_should_start(int nodeid, cluster_member_list_t *membership,
 #ifndef NO_CCS
 	if(nofailback) {
 		if (rg_lock(rg_name, &lockp) != 0) {
-			clulog(LOG_WARNING, "Error getting a lock\n");
-			RETURN(FOD_BEST);
+			log_printf(LOG_WARNING, "Error getting a lock\n");
+			return FOD_BEST;
 		}
                 
 		if (get_rg_state(rg_name, &svc_state) == RG_EFAIL) {
                 	/*
 			 * Couldn't get the service state, thats odd
 			 */
-			clulog(LOG_WARNING, "Problem getting state information for "
+			log_printf(LOG_WARNING, "Problem getting state information for "
 			       "%s\n", rg_name);
 			rg_unlock(&lockp);
-			RETURN(FOD_BEST);
+			return FOD_BEST;
 		}
 		rg_unlock(&lockp);
 
@@ -556,19 +542,19 @@ node_should_start(int nodeid, cluster_member_list_t *membership,
 		 * domain are online.
 		 */
 #ifdef DEBUG
-		clulog(LOG_DEBUG, "Member #%d is not a member and no "
+		log_printf(LOG_DEBUG, "Member #%d is not a member and no "
 		       "members are online\n", nodeid);
 #endif
 		if (!restricted) {
 #ifdef DEBUG
-			clulog(LOG_DEBUG,"Restricted mode off -> BEST\n");
+			log_printf(LOG_DEBUG,"Restricted mode off -> BEST\n");
 #endif
-			RETURN(FOD_BEST);
+			return FOD_BEST;
 		}
 #ifdef DEBUG
-		clulog(LOG_DEBUG,"Restricted mode -> ILLEGAL\n");
+		log_printf(LOG_DEBUG,"Restricted mode -> ILLEGAL\n");
 #endif
-		RETURN(FOD_ILLEGAL);
+		return FOD_ILLEGAL;
 	case 1:
 		/* 
 		 * Node is not a member of the domain and at least one member
@@ -576,26 +562,26 @@ node_should_start(int nodeid, cluster_member_list_t *membership,
 		 */
 		/* In this case, we can ignore 'restricted' */
 #ifdef DEBUG
-		clulog(LOG_DEBUG, "Member #%d is not a member of domain %s "
+		log_printf(LOG_DEBUG, "Member #%d is not a member of domain %s "
 		       "and a member is online\n", nodeid, domainname);
 #endif
 		if (!restricted) {
 #ifdef DEBUG
-			clulog(LOG_DEBUG,"Restricted mode off -> GOOD\n");
+			log_printf(LOG_DEBUG,"Restricted mode off -> GOOD\n");
 #endif
-			RETURN(FOD_GOOD);
+			return FOD_GOOD;
 		}
 #ifdef DEBUG
-		clulog(LOG_DEBUG,"Restricted mode -> ILLEGAL\n");
+		log_printf(LOG_DEBUG,"Restricted mode -> ILLEGAL\n");
 #endif
-		RETURN(FOD_ILLEGAL);
+		return FOD_ILLEGAL;
 	case 2:
 		/*
 		 * Node is a member of the domain, but is not the
 		 * lowest-ordered, online member.
 		 */
 #ifdef DEBUG
-		clulog(LOG_DEBUG, "Member #%d is a member, but is not the "
+		log_printf(LOG_DEBUG, "Member #%d is a member, but is not the "
 		       "lowest-ordered\n", nodeid);
 #endif
 		if (ordered) {
@@ -605,21 +591,21 @@ node_should_start(int nodeid, cluster_member_list_t *membership,
 			 */
 			if (nofailback && started && owned_by_node && !no_owner) {
 #ifdef DEBUG
-				clulog(LOG_DEBUG,"Ordered mode and no "
+				log_printf(LOG_DEBUG,"Ordered mode and no "
 				       "failback -> BEST\n");
 #endif
-				RETURN(FOD_BEST);
+				return FOD_BEST;
 			}
 #ifdef DEBUG
-			clulog(LOG_DEBUG,"Ordered mode -> BETTER\n");
+			log_printf(LOG_DEBUG,"Ordered mode -> BETTER\n");
 #endif
-			RETURN(FOD_BETTER);
+			return FOD_BETTER;
 		}
 
 #ifdef DEBUG
-		clulog(LOG_DEBUG,"Not using ordered mode -> BEST\n");
+		log_printf(LOG_DEBUG,"Not using ordered mode -> BEST\n");
 #endif
-		RETURN(FOD_BEST);
+		return FOD_BEST;
 	case 3:
 		/*
 		 * Node is a member of the domain and is the lowest-ordered,
@@ -628,26 +614,26 @@ node_should_start(int nodeid, cluster_member_list_t *membership,
 
 		if(nofailback && started && !owned_by_node && !no_owner) {
 #ifdef DEBUG
-			clulog(LOG_DEBUG, "Member #%d is the lowest-ordered "
+			log_printf(LOG_DEBUG, "Member #%d is the lowest-ordered "
 			       "memeber of the domain, but is not the owner "
 			       "-> BETTER\n", nodeid);
 #endif
-			RETURN(FOD_BETTER);
+			return FOD_BETTER;
 		}
  
 		/* In this case, we can ignore 'ordered' */
 #ifdef DEBUG
-		clulog(LOG_DEBUG, "Member #%d is the lowest-ordered member "
+		log_printf(LOG_DEBUG, "Member #%d is the lowest-ordered member "
 		       "of the domain -> BEST\n", nodeid);
 #endif
-		RETURN(FOD_BEST);
+		return FOD_BEST;
 	default:
 		/* Do what? */
-		clulog(LOG_ERR, "#32: Code path error: "
+		log_printf(LOG_ERR, "#32: Code path error: "
 		       "Invalid return from node_in_domain()\n");
-		RETURN(FOD_ILLEGAL);
+		return FOD_ILLEGAL;
 	}
 
 	/* not reached */
-	RETURN(FOD_ILLEGAL);
+	return FOD_ILLEGAL;
 }
diff --git a/rgmanager/src/daemons/groups.c b/rgmanager/src/daemons/groups.c
index 7300443..e89727b 100644
--- a/rgmanager/src/daemons/groups.c
+++ b/rgmanager/src/daemons/groups.c
@@ -6,7 +6,7 @@
 #include <vf.h>
 #include <message.h>
 #include <ccs.h>
-#include <clulog.h>
+#include <logging.h>
 #include <members.h>
 #include <list.h>
 #include <reslist.h>
@@ -107,14 +107,14 @@ count_resource_groups(cluster_member_list_t *ml)
 		res_build_name(rgname, sizeof(rgname), res);
 
 		if (rg_lock(rgname, &lockp) < 0) {
-			clulog(LOG_ERR, "#XX: Unable to obtain cluster "
+			log_printf(LOG_ERR, "#XX: Unable to obtain cluster "
 			       "lock @ %s:%d: %s\n", __FILE__, __LINE__,
 			       strerror(errno));
 			continue;
 		}
 
 		if (get_rg_state(rgname, &st) < 0) {
-			clulog(LOG_ERR, "#34: Cannot get status "
+			log_printf(LOG_ERR, "#34: Cannot get status "
 			       "for service %s\n", rgname);
 			rg_unlock(&lockp);
 			continue;
@@ -432,7 +432,7 @@ check_rdomain_crash(char *svcName)
 		goto out_free;
 
 	if (icount == 0) {
-		clulog(LOG_NOTICE, "Marking %s as stopped: "
+		log_printf(LOG_NOTICE, "Marking %s as stopped: "
 		       "Restricted domain unavailable\n", svcName);
 		rt_enqueue_request(svcName, RG_STOP, NULL, 0, 0,
 				   0, 0);
@@ -491,7 +491,7 @@ consider_start(resource_node_t *node, char *svcName, rg_state_t *svcStatus,
 				     (atoi(val)==0))));
 		if (!autostart) {
 			/*
-			clulog(LOG_DEBUG,
+			log_printf(LOG_DEBUG,
 			       "Skipping RG %s: Autostart disabled\n",
 			       svcName);
 			 */
@@ -500,14 +500,14 @@ consider_start(resource_node_t *node, char *svcName, rg_state_t *svcStatus,
 			   confusion!
 			 */
 			if (rg_lock(svcName, &lockp) < 0) {
-				clulog(LOG_ERR, "#XX: Unable to obtain cluster "
+				log_printf(LOG_ERR, "#XX: Unable to obtain cluster "
 				       "lock @ %s:%d: %s\n", __FILE__, __LINE__,
 				       strerror(errno));
 				return;
 			}
 
 			if (get_rg_state(svcName, svcStatus) != 0) {
-				clulog(LOG_ERR, "#34: Cannot get status "
+				log_printf(LOG_ERR, "#34: Cannot get status "
 				       "for service %s\n", svcName);
 				rg_unlock(&lockp);
 				return;
@@ -528,7 +528,7 @@ consider_start(resource_node_t *node, char *svcName, rg_state_t *svcStatus,
 	/* See if service this one depends on is running.  If not,
            don't start it */
 	if (check_depend(node->rn_resource) == 0) {
-		clulog(LOG_DEBUG,
+		log_printf(LOG_DEBUG,
 		       "Skipping RG %s: Dependency missing\n", svcName);
 		return;
 	}
@@ -537,7 +537,7 @@ consider_start(resource_node_t *node, char *svcName, rg_state_t *svcStatus,
 	exclusive = val && ((!strcmp(val, "yes") || (atoi(val)>0)));
 
 	if (exclusive && mp->cn_svccount) {
-		clulog(LOG_DEBUG,
+		log_printf(LOG_DEBUG,
 		       "Skipping RG %s: Exclusive and I am running services\n",
 		       svcName);
 		return;
@@ -548,7 +548,7 @@ consider_start(resource_node_t *node, char *svcName, rg_state_t *svcStatus,
 	   service.
 	 */
 	if (mp->cn_svcexcl) {
-		clulog(LOG_DEBUG,
+		log_printf(LOG_DEBUG,
 		       "Skipping RG %s: I am running an exclusive service\n",
 		       svcName);
 		return;
@@ -603,7 +603,7 @@ consider_relocate(char *svcName, rg_state_t *svcStatus, uint32_t nodeid,
 		req = RG_MIGRATE;
 	}
 
-	clulog(LOG_NOTICE, "%s %s to better node %s\n",
+	log_printf(LOG_NOTICE, "%s %s to better node %s\n",
 	       req==RG_MIGRATE ? "Migrating":"Relocating",
 	       svcName,
 	       memb_id_to_name(membership, nodeid));
@@ -684,7 +684,7 @@ eval_groups(int local, uint32_t nodeid, int nodeStatus)
 	int ret;
 
 	if (rg_locked()) {
-		clulog(LOG_DEBUG,
+		log_printf(LOG_DEBUG,
 			"Resource groups locked; not evaluating\n");
 		return -EAGAIN;
 	}
@@ -705,7 +705,7 @@ eval_groups(int local, uint32_t nodeid, int nodeStatus)
 		 * status.
 		 */
 		if ((ret = rg_lock(svcName, &lockp)) < 0) {
-			clulog(LOG_ERR,
+			log_printf(LOG_ERR,
 			       "#33: Unable to obtain cluster lock: %s\n",
 			       strerror(-ret));
 			pthread_rwlock_unlock(&resource_lock);
@@ -714,7 +714,7 @@ eval_groups(int local, uint32_t nodeid, int nodeStatus)
 		}
 		
 		if (get_rg_state(svcName, &svcStatus) != 0) {
-			clulog(LOG_ERR,
+			log_printf(LOG_ERR,
 			       "#34: Cannot get status for service %s\n",
 			       svcName);
 			rg_unlock(&lockp);
@@ -736,7 +736,7 @@ eval_groups(int local, uint32_t nodeid, int nodeStatus)
 			continue;
 		}
 
-		clulog(LOG_DEBUG, "Evaluating RG %s, state %s, owner "
+		log_printf(LOG_DEBUG, "Evaluating RG %s, state %s, owner "
 		       "%s\n", svcName,
 		       rg_state_str(svcStatus.rs_state),
 		       nodeName);
@@ -771,7 +771,7 @@ eval_groups(int local, uint32_t nodeid, int nodeStatus)
 	pthread_rwlock_unlock(&resource_lock);
 	free_member_list(membership);
 
-	clulog(LOG_DEBUG, "Event (%d:%d:%d) Processed\n", local,
+	log_printf(LOG_DEBUG, "Event (%d:%d:%d) Processed\n", local,
 	       (int)nodeid, nodeStatus);
 
 	return 0;
@@ -795,7 +795,7 @@ group_event(char __attribute__ ((unused)) *rg_name,
 	int depend;
 
 	if (rg_locked()) {
-		clulog(LOG_DEBUG,
+		log_printf(LOG_DEBUG,
 			"Resource groups locked; not evaluating\n");
 		return -EAGAIN;
 	}
@@ -847,7 +847,7 @@ group_event(char __attribute__ ((unused)) *rg_name,
 		    svcStatus.rs_state == RG_STATE_STOPPED &&
 		    state == RG_STATE_STARTED) {
 
-			clulog(LOG_DEBUG, "Evaluating RG %s, state %s, owner "
+			log_printf(LOG_DEBUG, "Evaluating RG %s, state %s, owner "
 			       "%s\n", svcName,
 			       rg_state_str(svcStatus.rs_state),
 			       nodeName);
@@ -863,7 +863,7 @@ group_event(char __attribute__ ((unused)) *rg_name,
 		    svcStatus.rs_state == RG_STATE_STARTED &&
 		    svcStatus.rs_owner == (uint32_t)my_id()) {
 
-			clulog(LOG_WARNING, "Stopping service %s: Dependency missing\n",
+			log_printf(LOG_WARNING, "Stopping service %s: Dependency missing\n",
 			       svcName);
 			rt_enqueue_request(svcName, RG_STOP, NULL, 0, my_id(),
 					   0, 0);
@@ -1007,7 +1007,7 @@ group_migrate(char *groupname, int target)
 	cluster_member_list_t *membership;
 
 	if (target <= 0) {
-		clulog(LOG_WARNING,
+		log_printf(LOG_WARNING,
 		       "Illegal node ID %d during migrate operation\n",
 		       target);
 		return RG_EINVAL;
@@ -1015,7 +1015,7 @@ group_migrate(char *groupname, int target)
 
 	membership = member_list();
 	if (!membership) {
-		clulog(LOG_ERR, "Unable to determine membership during "
+		log_printf(LOG_ERR, "Unable to determine membership during "
 		       "migrate operation\n");
 		return RG_EFAIL;
 	}
@@ -1024,7 +1024,7 @@ group_migrate(char *groupname, int target)
 	
 	tgt_name = memb_id_to_name(membership, target);
 	if (!tgt_name) {
-		clulog(LOG_WARNING, "Node ID %d not in membership during "
+		log_printf(LOG_WARNING, "Node ID %d not in membership during "
 		       "migrate operation\n", target);
 		ret = RG_EINVAL;
 		goto out;
@@ -1032,7 +1032,7 @@ group_migrate(char *groupname, int target)
 
 	res = find_root_by_ref(&_resources, groupname);
 	if (!res) {
-		clulog(LOG_WARNING,
+		log_printf(LOG_WARNING,
 		       "Unable to find '%s' in resource list during"
 		       "migrate operation\n", groupname);
 		goto out;
@@ -1046,20 +1046,20 @@ group_migrate(char *groupname, int target)
 	} while (!list_done(&_tree, tmp));
 
 	if (!rn) {
-		clulog(LOG_WARNING,
+		log_printf(LOG_WARNING,
 		       "Unable to find '%s' it top level of resource "
 		       "tree during migrate operation\n", groupname);
 		goto out;
 	}
 	
-	clulog(LOG_NOTICE, "Migrating %s to %s\n", groupname, tgt_name);
+	log_printf(LOG_NOTICE, "Migrating %s to %s\n", groupname, tgt_name);
 	ret = res_exec(rn, RS_MIGRATE, tgt_name, 0);
 	if (ret == 0) {
-		clulog(LOG_NOTICE,
+		log_printf(LOG_NOTICE,
 		       "Migration of %s to %s completed\n",
 		       groupname, tgt_name);
 	} else {
-		clulog(LOG_ERR, 
+		log_printf(LOG_ERR, 
 		       "Migration of %s to %s failed; return code %d\n",
 		       groupname, tgt_name, ret);
 	}
@@ -1267,7 +1267,7 @@ svc_exists(char *svcname)
 
 
 void
-rg_doall(int request, int block, char *debugfmt)
+rg_doall(int request, int block, char __attribute__ ((unused)) *debugfmt)
 {
 	resource_node_t *curr;
 	rg_state_t svcblk;
@@ -1279,8 +1279,8 @@ rg_doall(int request, int block, char *debugfmt)
 		/* Group name */
 		res_build_name(rg, sizeof(rg), curr->rn_resource);
 
-		if (debugfmt)
-			clulog(LOG_DEBUG, debugfmt, rg);
+		//if (debugfmt)
+			//log_printf(LOG_DEBUG, debugfmt, rg);
 
 		/* Optimization: Don't bother even queueing the request
 		   during the exit case if we don't own it */
@@ -1385,7 +1385,7 @@ do_condstops(void)
 	int need_kill;
 	char rg[64];
 
-	clulog(LOG_INFO, "Stopping changed resources.\n");
+	log_printf(LOG_INFO, "Stopping changed resources.\n");
 
 	pthread_rwlock_rdlock(&resource_lock);
 	list_do(&_tree, curr) {
@@ -1405,14 +1405,14 @@ do_condstops(void)
 		need_kill = 0;
 		if (curr->rn_resource->r_flags & RF_NEEDSTOP) {
 			need_kill = 1;
-			clulog(LOG_DEBUG, "Removing %s\n", rg);
+			log_printf(LOG_DEBUG, "Removing %s\n", rg);
 		}
 
 		if (!curr->rn_child && ((curr->rn_resource->r_rule->rr_flags &
 		    RF_DESTROY) == 0) && group_migratory(rg, 0) &&
 		    need_kill == 1) {
 			/* Do something smart here: flip state? */
-			clulog(LOG_NOTICE,
+			log_printf(LOG_NOTICE,
 			       "%s removed from the config, but I am not stopping it.\n",
 			       rg);
 			if (rg_lock(rg, &lockp) != 0)
@@ -1448,7 +1448,7 @@ do_condstarts(void)
 	int need_init, new_groups = 0, autostart;
 	struct dlm_lksb lockp;
 
-	clulog(LOG_INFO, "Starting changed resources.\n");
+	log_printf(LOG_INFO, "Starting changed resources.\n");
 
 	/* Pass 1: Start any normally changed resources */
 	pthread_rwlock_rdlock(&resource_lock);
@@ -1483,14 +1483,14 @@ do_condstarts(void)
 
 		if (need_init) {
 			++new_groups;
-			clulog(LOG_NOTICE, "Initializing %s\n", rg);
+			log_printf(LOG_NOTICE, "Initializing %s\n", rg);
 		}
 
 		if (!curr->rn_child && ((curr->rn_resource->r_rule->rr_flags &
 		    RF_INIT) == 0) && group_migratory(rg, 0) &&
 		    need_init == 1) {
 			/* Do something smart here? */
-			clulog(LOG_NOTICE,
+			log_printf(LOG_NOTICE,
 			       "%s was added to the config, but I am not initializing it.\n",
 			       rg);
 			continue;
@@ -1614,19 +1614,19 @@ init_resource_groups(int reconfigure, int do_init)
 	char *val;
 
 	if (reconfigure)
-		clulog(LOG_NOTICE, "Reconfiguring\n");
-	clulog(LOG_INFO, "Loading Service Data\n");
-	clulog(LOG_DEBUG, "Loading Resource Rules\n");
+		log_printf(LOG_NOTICE, "Reconfiguring\n");
+	log_printf(LOG_INFO, "Loading Service Data\n");
+	log_printf(LOG_DEBUG, "Loading Resource Rules\n");
 	if (load_resource_rules(RESOURCE_ROOTDIR, &rulelist) != 0) {
 		return -1;
 	}
 	x = 0;
 	list_do(&rulelist, rule) { ++x; } while (!list_done(&rulelist, rule));
-	clulog(LOG_DEBUG, "%d rules loaded\n", x);
+	log_printf(LOG_DEBUG, "%d rules loaded\n", x);
 
        	fd = ccs_lock();
 	if (fd == -1) {
-		clulog(LOG_CRIT, "#5: Couldn't connect to ccsd!\n");
+		log_printf(LOG_CRIT, "#5: Couldn't connect to ccsd!\n");
 		return -1;
 	}
 
@@ -1643,10 +1643,10 @@ init_resource_groups(int reconfigure, int do_init)
 		free(val);
 	}
 
-	clulog(LOG_DEBUG, "Building Resource Trees\n");
+	log_printf(LOG_DEBUG, "Building Resource Trees\n");
 	/* About to update the entire resource tree... */
 	if (load_resources(fd, &reslist, &rulelist) != 0) {
-		clulog(LOG_CRIT, "#6: Error loading services\n");
+		log_printf(LOG_CRIT, "#6: Error loading services\n");
 		destroy_resources(&reslist);
 		destroy_resource_rules(&rulelist);
 		ccs_unlock(fd);
@@ -1654,7 +1654,7 @@ init_resource_groups(int reconfigure, int do_init)
 	}
 
 	if (build_resource_tree(fd, &tree, &rulelist, &reslist) != 0) {
-		clulog(LOG_CRIT, "#7: Error building resource tree\n");
+		log_printf(LOG_CRIT, "#7: Error building resource tree\n");
 		destroy_resource_tree(&tree);
 		destroy_resources(&reslist);
 		destroy_resource_rules(&rulelist);
@@ -1664,13 +1664,13 @@ init_resource_groups(int reconfigure, int do_init)
 
 	x = 0;
 	list_do(&reslist, res) { ++x; } while (!list_done(&reslist, res));
-	clulog(LOG_DEBUG, "%d resources defined\n", x);
+	log_printf(LOG_DEBUG, "%d resources defined\n", x);
 
-	clulog(LOG_DEBUG, "Loading Failover Domains\n");
+	log_printf(LOG_DEBUG, "Loading Failover Domains\n");
 	construct_domains(fd, &domains);
 	x = 0;
 	list_do(&domains, fod) { ++x; } while (!list_done(&domains, fod));
-	clulog(LOG_DEBUG, "%d domains defined\n", x);
+	log_printf(LOG_DEBUG, "%d domains defined\n", x);
 	construct_events(fd, &evt);
 	cnt = 0;
 	if (evt) {
@@ -1687,7 +1687,7 @@ init_resource_groups(int reconfigure, int do_init)
 			cnt += y;
 		}
 	}
-	clulog(LOG_DEBUG, "%d events defined\n", x);
+	log_printf(LOG_DEBUG, "%d events defined\n", x);
 	
 
 	/* Reconfiguration done */
@@ -1725,16 +1725,16 @@ init_resource_groups(int reconfigure, int do_init)
 	if (reconfigure) {
 		/* Switch to read lock and do the up-half of the
 		   reconfig request */
-		clulog(LOG_INFO, "Restarting changed resources.\n");
+		log_printf(LOG_INFO, "Restarting changed resources.\n");
 		do_condstarts();
 	} else {
 		if (do_init) {
 			/* Do initial stop-before-start */
-			clulog(LOG_INFO, "Initializing Services\n");
+			log_printf(LOG_INFO, "Initializing Services\n");
 			rg_doall(RG_INIT, 1, "Initializing %s\n");
-			clulog(LOG_INFO, "Services Initialized\n");
+			log_printf(LOG_INFO, "Services Initialized\n");
 		} else {
-			clulog(LOG_INFO, "Skipping stop-before-start: overridden by administrator\n");
+			log_printf(LOG_INFO, "Skipping stop-before-start: overridden by administrator\n");
 		}
 		rg_set_initialized();
 	}
diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index bc2375d..c487094 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -8,7 +8,7 @@
 #include <rg_locks.h>
 #include <fcntl.h>
 #include <resgroup.h>
-#include <clulog.h>
+#include <logging.h>
 #include <members.h>
 #include <msgsimple.h>
 #include <vf.h>
@@ -138,16 +138,16 @@ membership_update(void)
 		if (!rg_quorate())
 			return -1;
 
-		clulog(LOG_EMERG, "#1: Quorum Dissolved\n");
+		log_printf(LOG_EMERG, "#1: Quorum Dissolved\n");
 		rg_set_inquorate();
 		member_list_update(NULL);/* Clear member list */
 		rg_lockall(L_SYS);
 		rg_doall(RG_INIT, 1, "Emergency stop of %s\n");
 #ifndef USE_OPENAIS
-		clulog(LOG_DEBUG, "Invalidating local VF cache\n");
+		log_printf(LOG_DEBUG, "Invalidating local VF cache\n");
 		vf_invalidate();
 #endif
-		clulog(LOG_DEBUG, "Flushing resource group cache\n");
+		log_printf(LOG_DEBUG, "Flushing resource group cache\n");
 		kill_resource_groups();
 		rg_set_uninitialized();
 		return -1;
@@ -156,7 +156,7 @@ membership_update(void)
 		rg_set_quorate();
 		rg_unlockall(L_SYS);
 		rg_unlockall(L_USER);
-		clulog(LOG_NOTICE, "Quorum Regained\n");
+		log_printf(LOG_NOTICE, "Quorum Regained\n");
 	}
 
 	old_membership = member_list();
@@ -190,7 +190,7 @@ membership_update(void)
 					port);
 
 			if (quorate == 0) {
-				clulog(LOG_DEBUG, "Node %d is not listening\n",
+				log_printf(LOG_DEBUG, "Node %d is not listening\n",
 					new_ml->cml_members[x].cn_nodeid);
 				new_ml->cml_members[x].cn_member = 0;
 				break;
@@ -224,7 +224,7 @@ membership_update(void)
 	me = memb_online(node_delta, my_id());
 	if (me) {
 		/* Should not happen */
-		clulog(LOG_INFO, "State change: LOCAL OFFLINE\n");
+		log_printf(LOG_INFO, "State change: LOCAL OFFLINE\n");
 		if (node_delta)
 			free_member_list(node_delta);
 		node_event(1, my_id(), 0, 0);
@@ -233,7 +233,7 @@ membership_update(void)
 
 	for (x=0; node_delta && x < node_delta->cml_count; x++) {
 
-		clulog(LOG_INFO, "State change: %s DOWN\n",
+		log_printf(LOG_INFO, "State change: %s DOWN\n",
 		       node_delta->cml_members[x].cn_name);
 		/* Don't bother evaluating anything resource groups are
 		   locked.  This is just a performance thing */
@@ -241,7 +241,7 @@ membership_update(void)
 			node_event_q(0, node_delta->cml_members[x].cn_nodeid,
 				     0, 0);
 		} else {
-			clulog(LOG_DEBUG, "Not taking action - services"
+			log_printf(LOG_DEBUG, "Not taking action - services"
 			       " locked\n");
 		}
 	}
@@ -255,7 +255,7 @@ membership_update(void)
 
 	me = memb_online(node_delta, my_id());
 	if (me) {
-		clulog(LOG_INFO, "State change: Local UP\n");
+		log_printf(LOG_INFO, "State change: Local UP\n");
 		node_event_q(1, my_id(), 1, 1);
 	}
 
@@ -267,7 +267,7 @@ membership_update(void)
 		if (node_delta->cml_members[x].cn_nodeid == my_id())
 			continue;
 
-		clulog(LOG_INFO, "State change: %s UP\n",
+		log_printf(LOG_INFO, "State change: %s UP\n",
 		       node_delta->cml_members[x].cn_name);
 		node_event_q(0, node_delta->cml_members[x].cn_nodeid, 1, 1);
 	}
@@ -290,7 +290,7 @@ lock_commit_cb(char __attribute__ ((unused)) *key,
 	char lockstate;
 
 	if (datalen != 1) {
-		clulog(LOG_WARNING, "%s: invalid data length!\n", __FUNCTION__);
+		log_printf(LOG_WARNING, "%s: invalid data length!\n", __FUNCTION__);
 		free(data);
 		return 0;
 	}
@@ -301,18 +301,18 @@ lock_commit_cb(char __attribute__ ((unused)) *key,
 	if (lockstate == 0) {
 		rg_unlockall(L_USER); /* Doing this multiple times
 					 has no effect */
-		clulog(LOG_NOTICE, "Resource Groups Unlocked\n");
+		log_printf(LOG_NOTICE, "Resource Groups Unlocked\n");
 		return 0;
 	}
 
 	if (lockstate == 1) {
 		rg_lockall(L_USER); /* Doing this multiple times
 				       has no effect */
-		clulog(LOG_NOTICE, "Resource Groups Locked\n");
+		log_printf(LOG_NOTICE, "Resource Groups Locked\n");
 		return 0;
 	}
 
-	clulog(LOG_DEBUG, "Invalid lock state in callback: %d\n", lockstate);
+	log_printf(LOG_DEBUG, "Invalid lock state in callback: %d\n", lockstate);
 	return 0;
 }
 
@@ -384,7 +384,7 @@ do_lockreq(msgctx_t *ctx, int req)
 
 #ifdef OPENAIS
 	ret = ds_write("rg_lockdown", &state, 1);
-	clulog(LOG_INFO, "FIXME: send RG_LOCK update to all!\n");
+	log_printf(LOG_INFO, "FIXME: send RG_LOCK update to all!\n");
 #else
 	ret = vf_write(m, VFF_IGN_CONN_ERRORS, "rg_lockdown", &state, 1);
 	free_member_list(m);
@@ -422,7 +422,7 @@ dispatch_msg(msgctx_t *ctx, int nodeid, int need_close)
 	/* Peek-a-boo */
 	sz = msg_receive(ctx, msg_hdr, sizeof(msgbuf), 1);
 	if (sz < (int)sizeof (generic_msg_hdr)) {
-		clulog(LOG_ERR,
+		log_printf(LOG_ERR,
 		       "#37: Error receiving header from %d sz=%d CTX %p\n",
 		       nodeid, sz, ctx);
 		goto out;
@@ -444,27 +444,27 @@ dispatch_msg(msgctx_t *ctx, int nodeid, int need_close)
 	/* Decode the header */
 	swab_generic_msg_hdr(msg_hdr);
 	if ((msg_hdr->gh_magic != GENERIC_HDR_MAGIC)) {
-		clulog(LOG_ERR,
+		log_printf(LOG_ERR,
 		       "#38: Invalid magic: Wanted 0x%08x, got 0x%08x\n",
 		       GENERIC_HDR_MAGIC, msg_hdr->gh_magic);
 		goto out;
 	}
 
 	if ((int)msg_hdr->gh_length != sz) {
-		clulog(LOG_ERR, "#XX: Read size mismatch: %d %d\n",
+		log_printf(LOG_ERR, "#XX: Read size mismatch: %d %d\n",
 		       ret, msg_hdr->gh_length);
 		goto out;
 	}
 
 	switch (msg_hdr->gh_command) {
 	case RG_STATUS:
-		//clulog(LOG_DEBUG, "Sending service states to CTX%p\n",ctx);
+		//log_printf(LOG_DEBUG, "Sending service states to CTX%p\n",ctx);
 		if (send_rg_states(ctx, msg_hdr->gh_arg1) == 0)
 			need_close = 0;
 		break;
 
 	case RG_STATUS_NODE:
-		//clulog(LOG_DEBUG, "Sending node states to CTX%p\n",ctx);
+		//log_printf(LOG_DEBUG, "Sending node states to CTX%p\n",ctx);
 		send_node_states(ctx);
 		break;
 
@@ -484,7 +484,7 @@ dispatch_msg(msgctx_t *ctx, int nodeid, int need_close)
 	case RG_ACTION_REQUEST:
 
 		if (sz < (int)sizeof(msg_sm)) {
-			clulog(LOG_ERR,
+			log_printf(LOG_ERR,
 			       "#39: Error receiving entire request (%d/%d)\n",
 			       ret, (int)sizeof(msg_sm));
 			ret = -1;
@@ -503,7 +503,7 @@ dispatch_msg(msgctx_t *ctx, int nodeid, int need_close)
 
 			if (msg_send(ctx, msg_sm, sizeof (SmMessageSt)) <
 		    	    (int)sizeof (SmMessageSt))
-				clulog(LOG_ERR, "#40: Error replying to "
+				log_printf(LOG_ERR, "#40: Error replying to "
 				       "action request.\n");
 			ret = -1;
 			goto out;
@@ -543,7 +543,7 @@ dispatch_msg(msgctx_t *ctx, int nodeid, int need_close)
 	case RG_EVENT:
 		/* Service event.  Run a dependency check */
 		if (sz < (int)sizeof(msg_sm)) {
-			clulog(LOG_ERR,
+			log_printf(LOG_ERR,
 			       "#39: Error receiving entire request (%d/%d)\n",
 			       ret, (int)sizeof(msg_sm));
 			ret = -1;
@@ -566,7 +566,7 @@ dispatch_msg(msgctx_t *ctx, int nodeid, int need_close)
 		if (!member_online(msg_hdr->gh_arg1))
 			break;
 
-		clulog(LOG_NOTICE, "Member %d shutting down\n",
+		log_printf(LOG_NOTICE, "Member %d shutting down\n",
 		       msg_hdr->gh_arg1);
 	       	member_set_state(msg_hdr->gh_arg1, 0);
 		node_event_q(0, msg_hdr->gh_arg1, 0, 1);
@@ -580,7 +580,7 @@ dispatch_msg(msgctx_t *ctx, int nodeid, int need_close)
 		break;
 
 	default:
-		clulog(LOG_DEBUG, "unhandled message request %d\n",
+		log_printf(LOG_DEBUG, "unhandled message request %d\n",
 		       msg_hdr->gh_command);
 		break;
 	}
@@ -610,18 +610,18 @@ handle_cluster_event(msgctx_t *ctx)
 	switch(ret) {
 	case M_PORTOPENED:
 		msg_receive(ctx, NULL, 0, 0);
-		clulog(LOG_DEBUG, "Event: Port Opened\n");
+		log_printf(LOG_DEBUG, "Event: Port Opened\n");
 		membership_update();
 		break;
 	case M_PORTCLOSED:
 		/* Might want to handle powerclosed like membership change */
 		msg_receive(ctx, NULL, 0, 0);
-		clulog(LOG_DEBUG, "Event: Port Closed\n");
+		log_printf(LOG_DEBUG, "Event: Port Closed\n");
 		membership_update();
 		break;
 	case M_NONE:
 		msg_receive(ctx, NULL, 0, 0);
-		clulog(LOG_DEBUG, "NULL cluster message\n");
+		log_printf(LOG_DEBUG, "NULL cluster message\n");
 		break;
 	case M_OPEN:
 		newctx = msg_new_ctx();
@@ -642,12 +642,12 @@ handle_cluster_event(msgctx_t *ctx)
 		
 	case M_OPEN_ACK:
 	case M_CLOSE:
-		clulog(LOG_DEBUG, "I should NOT get here: %d\n",
+		log_printf(LOG_DEBUG, "I should NOT get here: %d\n",
 		       ret);
 		break;
 	case M_STATECHANGE:
 		msg_receive(ctx, NULL, 0, 0);
-		clulog(LOG_DEBUG, "Membership Change Event\n");
+		log_printf(LOG_DEBUG, "Membership Change Event\n");
 		if (running) {
 			rg_unlockall(L_SYS);
 			membership_update();
@@ -658,7 +658,7 @@ handle_cluster_event(msgctx_t *ctx)
 	case 999:
 	case M_TRY_SHUTDOWN:
 		msg_receive(ctx, NULL, 0, 0);
-		clulog(LOG_WARNING, "#67: Shutting down uncleanly\n");
+		log_printf(LOG_WARNING, "#67: Shutting down uncleanly\n");
 		rg_set_inquorate();
 		rg_doall(RG_INIT, 1, "Emergency stop of %s");
 		rg_set_uninitialized();
@@ -839,16 +839,7 @@ configure_rgmanager(int ccsfd, int dbg)
 			return -1;
 	}
 
-	if (ccs_get(ccsfd, "/cluster/rm/@log_facility", &v) == 0) {
-		clu_set_facility(v);
-		free(v);
-	}
-
-	if (ccs_get(ccsfd, "/cluster/rm/@log_level", &v) == 0) {
-		if (!dbg)
-			clu_set_loglevel(atoi(v));
-		free(v);
-	}
+	setup_logging(ccsfd);
 
 	if (ccs_get(ccsfd, "/cluster/rm/@transition_throttling", &v) == 0) {
 		set_transition_throttling(atoi(v));
@@ -858,7 +849,7 @@ configure_rgmanager(int ccsfd, int dbg)
 	if (ccs_get(ccsfd, "/cluster/rm/@central_processing", &v) == 0) {
 		set_central_events(atoi(v));
 		if (atoi(v))
-			clulog(LOG_NOTICE,
+			log_printf(LOG_NOTICE,
 			       "Centralized Event Processing enabled\n");
 		free(v);
 	}
@@ -866,10 +857,11 @@ configure_rgmanager(int ccsfd, int dbg)
 	if (ccs_get(ccsfd, "/cluster/rm/@status_poll_interval", &v) == 0) {
 		status_poll_interval = atoi(v);
 		if (status_poll_interval >= 1) {
-			clulog(LOG_NOTICE,
-			       "Status Polling Interval set to %d\n", v);
+			log_printf(LOG_NOTICE,
+			       "Status Polling Interval set to %d\n",
+			       status_poll_interval);
 		} else {
-			clulog(LOG_WARNING, "Ignoring illegal "
+			log_printf(LOG_WARNING, "Ignoring illegal "
 			       "status_poll_interval of %s\n", v);
 			status_poll_interval = 10;
 		}
@@ -893,7 +885,7 @@ clu_initialize(cman_handle_t *ch)
 
 	*ch = cman_init(NULL);
 	if (!(*ch)) {
-		clulog(LOG_NOTICE, "Waiting for CMAN to start\n");
+		log_printf(LOG_NOTICE, "Waiting for CMAN to start\n");
 
 		while (!(*ch = cman_init(NULL))) {
 			sleep(1);
@@ -907,12 +899,12 @@ clu_initialize(cman_handle_t *ch)
 		   and log in -- this will cause the plugin to not select any
 		   node group (if any exist).
 		 */
-		clulog(LOG_NOTICE, "Waiting for quorum to form\n");
+		log_printf(LOG_NOTICE, "Waiting for quorum to form\n");
 
 		while (cman_is_quorate(*ch) == 0) {
 			sleep(1);
 		}
-		clulog(LOG_NOTICE, "Quorum formed\n");
+		log_printf(LOG_NOTICE, "Quorum formed\n");
 	}
 
 }
@@ -922,14 +914,14 @@ void
 wait_for_fencing(void)
 {
         if (node_has_fencing(my_id()) && !fence_domain_joined()) {
-		clulog(LOG_INFO, "Waiting for fence domain join operation "
+		log_printf(LOG_INFO, "Waiting for fence domain join operation "
 		       "to complete\n");
 
 		while (fence_domain_joined() == 0)
 			sleep(1);
-		clulog(LOG_INFO, "Fence domain joined\n");
+		log_printf(LOG_INFO, "Fence domain joined\n");
 	} else {
-		clulog(LOG_DEBUG, "Fence domain already joined "
+		log_printf(LOG_DEBUG, "Fence domain already joined "
 		       "or no fencing configured\n");
 	}
 }
@@ -993,15 +985,17 @@ main(int argc, char **argv)
 	/*
 	   Set up logging / foreground mode, etc.
 	 */
+#if 0
 	if (debug)
 		clu_set_loglevel(LOG_DEBUG);
 	if (foreground)
 		clu_log_console(1);
+#endif
 
 	if (!foreground && (geteuid() == 0)) {
 		daemon_init(argv[0]);
 		if (wd && !debug && !watchdog_init())
-			clulog(LOG_NOTICE, "Failed to start watchdog\n");
+			log_printf(LOG_NOTICE, "Failed to start watchdog\n");
 	}
 
 	setup_signal(SIGINT, flag_shutdown);
@@ -1016,6 +1010,7 @@ main(int argc, char **argv)
 		unblock_signal(SIGSEGV);
 	}
 
+	init_logging();
 	clu_initialize(&clu);
 	if (cman_init_subsys(clu) < 0) {
 		perror("cman_init_subsys");
@@ -1037,7 +1032,7 @@ main(int argc, char **argv)
 	}
 	set_my_id(me.cn_nodeid);
 
-	clulog(LOG_INFO, "I am node #%d\n", my_id());
+	log_printf(LOG_INFO, "I am node #%d\n", my_id());
 
 	wait_for_fencing();
 
@@ -1046,22 +1041,22 @@ main(int argc, char **argv)
 	   read the resource group trees from ccsd.
 	 */
 	configure_rgmanager(-1, debug);
-	clulog(LOG_NOTICE, "Resource Group Manager Starting\n");
+	log_printf(LOG_NOTICE, "Resource Group Manager Starting\n");
 
 	if (init_resource_groups(0, do_init) != 0) {
-		clulog(LOG_CRIT, "#8: Couldn't initialize services\n");
+		log_printf(LOG_CRIT, "#8: Couldn't initialize services\n");
 		return -1;
 	}
 
 	if (msg_listen(MSG_SOCKET, RGMGR_SOCK, me.cn_nodeid, &local_ctx) < 0) {
-		clulog(LOG_CRIT,
+		log_printf(LOG_CRIT,
 		       "#10: Couldn't set up cluster message system: %s\n",
 		       strerror(errno));
 		return -1;
 	}
 
 	if (msg_listen(MSG_CLUSTER, &port, me.cn_nodeid, &cluster_ctx) < 0) {
-		clulog(LOG_CRIT,
+		log_printf(LOG_CRIT,
 		       "#10b: Couldn't set up cluster message system: %s\n",
 		       strerror(errno));
 		return -1;
@@ -1079,14 +1074,14 @@ main(int argc, char **argv)
 	 */
 #ifdef OPENAIS
 	if (ds_init() < 0) {
-		clulog(LOG_CRIT, "#11b: Couldn't initialize SAI AIS CKPT\n");
+		log_printf(LOG_CRIT, "#11b: Couldn't initialize SAI AIS CKPT\n");
 		return -1;
 	}
 
 	ds_key_init("rg_lockdown", 32, 10);
 #else
 	if (vf_init(me.cn_nodeid, port, NULL, NULL) != 0) {
-		clulog(LOG_CRIT, "#11: Couldn't set up VF listen socket\n");
+		log_printf(LOG_CRIT, "#11: Couldn't set up VF listen socket\n");
 		return -1;
 	}
 
@@ -1105,17 +1100,18 @@ main(int argc, char **argv)
 			   be ignored here */
 			msg_close(local_ctx);
 			++shutdown_pending;
-			clulog(LOG_NOTICE, "Shutting down\n");
+			log_printf(LOG_NOTICE, "Shutting down\n");
 			pthread_create(&th, NULL, shutdown_thread, NULL);
 		}
 	}
 
 	if (rg_initialized())
 		cleanup(cluster_ctx);
-	clulog(LOG_NOTICE, "Shutdown complete, exiting\n");
+	log_printf(LOG_NOTICE, "Shutdown complete, exiting\n");
 	clu_lock_finished(rgmanager_lsname);
 	cman_finish(clu);
 	
+	close_logging();
 	/*malloc_dump_table(); */ /* Only works if alloc.c us used */
 	/*malloc_stats();*/
 
diff --git a/rgmanager/src/daemons/reslist.c b/rgmanager/src/daemons/reslist.c
index d6fb015..fb50597 100644
--- a/rgmanager/src/daemons/reslist.c
+++ b/rgmanager/src/daemons/reslist.c
@@ -11,8 +11,9 @@
 #include <restart_counter.h>
 #include <reslist.h>
 #include <pthread.h>
+#include <libgen.h>
 #ifndef NO_CCS
-#include <clulog.h>
+#include <logging.h>
 #endif
 
 
@@ -398,7 +399,7 @@ store_resource(resource_t **reslist, resource_t *newres)
 					       newres->r_attrs[x].ra_value
 					       );
 #else 
-					clulog(LOG_ERR,
+					log_printf(LOG_ERR,
                                                "%s attribute collision. "
                                                "type=%s attr=%s value=%s\n",
 					       (newres->r_attrs[x].ra_flags&
@@ -853,7 +854,7 @@ load_resources(int ccsfd, resource_t **reslist, resource_rule_t **rulelist)
 	       		       printf("Error storing %s resource\n",
 				      newres->r_rule->rr_type);
 #else
-	       		       clulog(LOG_ERR,
+	       		       log_printf(LOG_ERR,
 				      "Error storing %s resource\n",
 				      newres->r_rule->rr_type);
 #endif
diff --git a/rgmanager/src/daemons/resrules.c b/rgmanager/src/daemons/resrules.c
index 3d0a783..7c070df 100644
--- a/rgmanager/src/daemons/resrules.c
+++ b/rgmanager/src/daemons/resrules.c
@@ -16,7 +16,7 @@
 #include <dirent.h>
 #include <libgen.h>
 #ifndef NO_CCS
-#include <clulog.h>
+#include <logging.h>
 #endif
 
 
@@ -39,7 +39,7 @@ store_rule(resource_rule_t **rulelist, resource_rule_t *newrule)
 			fprintf(stderr, "Error storing %s: Duplicate\n",
 				newrule->rr_type);
 #else
-			clulog(LOG_ERR, "Error storing %s: Duplicate\n",
+			log_printf(LOG_ERR, "Error storing %s: Duplicate\n",
 			       newrule->rr_type);
 #endif
 			return -1;
@@ -1013,7 +1013,7 @@ load_resource_rulefile(char *filename, resource_rule_t **rules)
 				"Error: Resource type '%s' is reserved",
 				type);
 #else
-			clulog(LOG_ERR,
+			log_printf(LOG_ERR,
 				"Error: Resource type '%s' is reserved",
 				type);
 #endif
diff --git a/rgmanager/src/daemons/restree.c b/rgmanager/src/daemons/restree.c
index 94e8b2f..9bc02a3 100644
--- a/rgmanager/src/daemons/restree.c
+++ b/rgmanager/src/daemons/restree.c
@@ -12,7 +12,7 @@
 #include <restart_counter.h>
 #include <reslist.h>
 #include <pthread.h>
-#include <clulog.h>
+#include <logging.h>
 #include <assert.h>
 
 #ifdef INTERNAL_MALLOC
@@ -441,12 +441,11 @@ res_exec(resource_node_t *node, int op, const char *arg, int depth)
 
 		if (pid != childpid && sleeptime == 0) {
 
-			clulog(LOG_ERR,
+			log_printf(LOG_ERR,
 			       "%s on %s:%s timed out after %d seconds\n",
 			       op_str, res->r_rule->rr_type,
 			       res->r_attrs->ra_value,
-			       node->rn_actions[act_index].ra_timeout,
-			       ocf_strerror(ret));
+			       (int)node->rn_actions[act_index].ra_timeout);
 			
 			/* This can't be guaranteed to kill even the child
 			   process if the child is in disk-wait :( */
@@ -454,7 +453,7 @@ res_exec(resource_node_t *node, int op, const char *arg, int depth)
 			sleep(1);
 			pid = waitpid(childpid, &ret, WNOHANG);
 			if (pid == 0) {
-				clulog(LOG_ERR,
+				log_printf(LOG_ERR,
 				       "Task %s PID %d did not exit "
 				       "after SIGKILL\n",
 				       op_str, childpid);
@@ -482,7 +481,7 @@ res_exec(resource_node_t *node, int op, const char *arg, int depth)
 #else
 		if (ret) {
 #endif
-			clulog(LOG_NOTICE,
+			log_printf(LOG_NOTICE,
 			       "%s on %s \"%s\" returned %d (%s)\n",
 			       op_str, res->r_rule->rr_type,
 			       res->r_attrs->ra_value, ret,
diff --git a/rgmanager/src/daemons/rg_event.c b/rgmanager/src/daemons/rg_event.c
index 41a88ca..fbaca97 100644
--- a/rgmanager/src/daemons/rg_event.c
+++ b/rgmanager/src/daemons/rg_event.c
@@ -4,7 +4,7 @@
 #include <assert.h>
 #include <libcman.h>
 #include <ccs.h>
-#include <clulog.h>
+#include <logging.h>
 #include <lock.h>
 #include <event.h>
 #include <stdint.h>
@@ -89,20 +89,20 @@ node_event(int local, int nodeID, int nodeStatus,
 
 		/* Local Node Event */
 		if (nodeStatus == 0) {
-			clulog(LOG_ERR, "Exiting uncleanly\n");
+			log_printf(LOG_ERR, "Exiting uncleanly\n");
 			hard_exit();
 		}
 
 		if (!rg_initialized()) {
 			if (init_resource_groups(0) != 0) {
-				clulog(LOG_ERR,
+				log_printf(LOG_ERR,
 				       "#36: Cannot initialize services\n");
 				hard_exit();
 			}
 		}
 
 		if (shutdown_pending) {
-			clulog(LOG_NOTICE, "Processing delayed exit signal\n");
+			log_printf(LOG_NOTICE, "Processing delayed exit signal\n");
 			running = 0;
 			return;
 		}
@@ -118,7 +118,7 @@ node_event(int local, int nodeID, int nodeStatus,
 	 * Nothing to do for events from other nodes if we are not ready.
 	 */
 	if (!rg_initialized()) {
-		clulog(LOG_DEBUG, "Services not initialized.\n");
+		log_printf(LOG_DEBUG, "Services not initialized.\n");
 		return;
 	}
 
@@ -141,7 +141,7 @@ node_has_fencing(int nodeid)
 	
 	ccs_desc = ccs_connect();
 	if (ccs_desc < 0) {
-		clulog(LOG_ERR, "Unable to connect to ccsd; cannot handle"
+		log_printf(LOG_ERR, "Unable to connect to ccsd; cannot handle"
 		       " node event!\n");
 		/* Assume node has fencing */
 		return 1;
@@ -207,20 +207,20 @@ master_event_callback(char __attribute__ ((unused)) *key,
 
 	m = data;
 	if (datalen != (uint32_t)sizeof(*m)) {
-		clulog(LOG_ERR, "%s: wrong size\n", __FUNCTION__);
+		log_printf(LOG_ERR, "%s: wrong size\n", __FUNCTION__);
 		return 1;
 	}
 
 	swab_event_master_t(m);
 	if (m->m_magic != EVENT_MASTER_MAGIC) {
-		clulog(LOG_ERR, "%s: wrong size\n", __FUNCTION__);
+		log_printf(LOG_ERR, "%s: wrong size\n", __FUNCTION__);
 		return 1;
 	}
 
 	if (m->m_nodeid == (uint32_t)my_id())
-		clulog(LOG_DEBUG, "Master Commit: I am master\n");
+		log_printf(LOG_DEBUG, "Master Commit: I am master\n");
 	else 
-		clulog(LOG_DEBUG, "Master Commit: %d is master\n", m->m_nodeid);
+		log_printf(LOG_DEBUG, "Master Commit: %d is master\n", m->m_nodeid);
 
 	pthread_mutex_lock(&mi_mutex);
 	if (mi)
@@ -249,7 +249,7 @@ find_master(void)
 	m = member_list();
 	if (vf_read(m, "Transition-Master", &vn,
 		    (void **)(&data), &sz) < 0) {
-		clulog(LOG_ERR, "Unable to discover master"
+		log_printf(LOG_ERR, "Unable to discover master"
 		       " status\n");
 		masterinfo = NULL;
 	} else {
@@ -260,7 +260,7 @@ find_master(void)
 	if (masterinfo && (sz >= sizeof(*masterinfo))) {
 		swab_event_master_t(masterinfo);
 		if (masterinfo->m_magic == EVENT_MASTER_MAGIC) {
-			clulog(LOG_DEBUG, "Master Locate: %d is master\n",
+			log_printf(LOG_DEBUG, "Master Locate: %d is master\n",
 			       masterinfo->m_nodeid);
 			pthread_mutex_lock(&mi_mutex);
 			if (mi)
@@ -322,7 +322,7 @@ event_master(void)
 		master_id = mi->m_nodeid;
 		pthread_mutex_unlock(&mi_mutex);
 		if (memb_online(m, master_id)) {
-			//clulog(LOG_DEBUG, "%d is master\n", mi->m_nodeid);
+			//log_printf(LOG_DEBUG, "%d is master\n", mi->m_nodeid);
 			goto out;
 		}
 	}
@@ -353,7 +353,7 @@ event_master(void)
 	if (vf_write(m, VFF_IGN_CONN_ERRORS | VFF_RETRY,
 		     "Transition-Master", &masterinfo,
 		     sizeof(masterinfo)) < 0) {
-		clulog(LOG_ERR, "Unable to advertise master"
+		log_printf(LOG_ERR, "Unable to advertise master"
 		       " status to all nodes\n");
 	}
 
@@ -408,7 +408,7 @@ _event_thread_f(void __attribute__ ((unused)) *arg)
 
 		if (ev->ev_type == EVENT_CONFIG) {
 			/*
-			clulog(LOG_NOTICE, "Config Event: %d -> %d\n",
+			log_printf(LOG_NOTICE, "Config Event: %d -> %d\n",
 			       ev->ev.config.cfg_oldversion,
 			       ev->ev.config.cfg_version);
 			 */
@@ -432,7 +432,7 @@ _event_thread_f(void __attribute__ ((unused)) *arg)
 
 		if (ev->ev_type == EVENT_RG) {
 			/*
-			clulog(LOG_NOTICE, "RG Event: %s %s %d\n",
+			log_printf(LOG_NOTICE, "RG Event: %s %s %d\n",
 			       ev->ev.group.rg_name,
 			       rg_state_str(ev->ev.group.rg_state),
 			       ev->ev.group.rg_owner);
@@ -442,7 +442,7 @@ _event_thread_f(void __attribute__ ((unused)) *arg)
 				    ev->ev.group.rg_owner);
 		} else if (ev->ev_type == EVENT_NODE) {
 			/*
-			clulog(LOG_NOTICE, "Node Event: %s %d %s %s\n",
+			log_printf(LOG_NOTICE, "Node Event: %s %d %s %s\n",
 			       ev->ev.node.ne_local?"Local":"Remote",
 			       ev->ev.node.ne_nodeid,
 			       ev->ev.node.ne_state?"UP":"DOWN",
@@ -456,7 +456,7 @@ _event_thread_f(void __attribute__ ((unused)) *arg)
 				while (!node_fenced(ev->ev.node.ne_nodeid)) {
 					if (!notice) {
 						notice = 1;
-						clulog(LOG_INFO, "Waiting for "
+						log_printf(LOG_INFO, "Waiting for "
 						       "node #%d to be fenced\n",
 						       ev->ev.node.ne_nodeid);
 					}
@@ -464,7 +464,7 @@ _event_thread_f(void __attribute__ ((unused)) *arg)
 				}
 
 				if (notice)
-					clulog(LOG_INFO, "Node #%d fenced; "
+					log_printf(LOG_INFO, "Node #%d fenced; "
 					       "continuing\n",
 					       ev->ev.node.ne_nodeid);
 			}
@@ -479,7 +479,7 @@ _event_thread_f(void __attribute__ ((unused)) *arg)
 	}
 
 	if (!central_events || _master) {
-		clulog(LOG_DEBUG, "%d events processed\n", count);
+		log_printf(LOG_DEBUG, "%d events processed\n", count);
 	}
 	/* Mutex held */
 	event_thread = 0;
diff --git a/rgmanager/src/daemons/rg_forward.c b/rgmanager/src/daemons/rg_forward.c
index 197cddd..e8801bd 100644
--- a/rgmanager/src/daemons/rg_forward.c
+++ b/rgmanager/src/daemons/rg_forward.c
@@ -4,7 +4,7 @@
 #include <rg_queue.h>
 #include <platform.h>
 #include <msgsimple.h>
-#include <clulog.h>
+#include <logging.h>
 #include <message.h>
 #include <members.h>
 
@@ -48,13 +48,13 @@ forwarding_thread(void *arg)
 	int new_owner = 0, retries = 0;
 
 	if (rg_lock(req->rr_group, &lockp) != 0) {
-		clulog(LOG_WARNING, "FW: Forwarding failed; lock unavailable for %s\n",
+		log_printf(LOG_WARNING, "FW: Forwarding failed; lock unavailable for %s\n",
 		       req->rr_group);
 		goto out_fail;
 	}
 	if (get_rg_state(req->rr_group, &rgs) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_WARNING, "FW: Forwarding failed; state unavailable for %s\n",
+		log_printf(LOG_WARNING, "FW: Forwarding failed; state unavailable for %s\n",
 		       req->rr_group);
 		goto out_fail;
 	}
@@ -63,20 +63,20 @@ forwarding_thread(void *arg)
 	if (rgs.rs_owner == 0)
 		rgs.rs_owner = req->rr_target;
 	if (rgs.rs_owner == 0) {
-		clulog(LOG_ERR, "FW: Attempt to forward to invalid node ID\n");
+		log_printf(LOG_ERR, "FW: Attempt to forward to invalid node ID\n");
        		goto out_fail;
 	}
 	if (rgs.rs_owner == (uint32_t)my_id()) {
-		clulog(LOG_WARNING, "BUG! Attempt to forward to myself!\n");
+		log_printf(LOG_WARNING, "BUG! Attempt to forward to myself!\n");
        		goto out_fail;
 	}
 
-	clulog(LOG_DEBUG, "FW: Forwarding %s request to %d\n",
+	log_printf(LOG_DEBUG, "FW: Forwarding %s request to %d\n",
 	       rg_req_str(req->rr_request), rgs.rs_owner);
 
 	ctx = msg_new_ctx();
 	if (ctx == NULL) {
-		clulog(LOG_DEBUG, "FW: Failed to allocate socket context: %s\n",
+		log_printf(LOG_DEBUG, "FW: Failed to allocate socket context: %s\n",
 		       strerror(errno));
 		goto out_fail;
 	}
@@ -86,12 +86,12 @@ forwarding_thread(void *arg)
 		      req->rr_arg0, req->rr_arg1);
 
 	if (msg_open(MSG_CLUSTER, rgs.rs_owner, RG_PORT, ctx, 10) < 0) {
-		clulog(LOG_DEBUG, "FW: Failed to open channel to %d CTX: %p\n",
+		log_printf(LOG_DEBUG, "FW: Failed to open channel to %d CTX: %p\n",
 		       rgs.rs_owner, ctx);
 		goto out_fail;
 	}
 	if (msg_send(ctx, &msg, sizeof(msg)) < (int)sizeof(msg)) {
-		clulog(LOG_DEBUG, "FW: Failed to send message to %d CTX: %p\n",
+		log_printf(LOG_DEBUG, "FW: Failed to send message to %d CTX: %p\n",
 		       rgs.rs_owner, ctx);
 		goto out_fail;
 	}
@@ -175,17 +175,17 @@ forwarding_thread_v2(void *arg)
 	resp_ctx = fwmsg->ctx;
 	target = fwmsg->nodeid;
 
-	clulog(LOG_DEBUG, "FW: Forwarding SM request to %d\n",
+	log_printf(LOG_DEBUG, "FW: Forwarding SM request to %d\n",
 	       target);
 
 	ctx = msg_new_ctx();
 	if (ctx == NULL) {
-		clulog(LOG_DEBUG, "FW: Failed to allocate socket context: %s\n",
+		log_printf(LOG_DEBUG, "FW: Failed to allocate socket context: %s\n",
 		       strerror(errno));
 		goto out_fail;
 	}
 	if (msg_open(MSG_CLUSTER, target, RG_PORT, ctx, 10) < 0) {
-		clulog(LOG_DEBUG, "FW: Failed to open channel to %d CTX: %p\n",
+		log_printf(LOG_DEBUG, "FW: Failed to open channel to %d CTX: %p\n",
 		       target, ctx);
 		goto out_fail;
 	}
@@ -193,7 +193,7 @@ forwarding_thread_v2(void *arg)
 	/* swap + send */
 	swab_SmMessageSt(msgp);
 	if (msg_send(ctx, msgp, sizeof(*msgp)) < (int)sizeof(*msgp)) {
-		clulog(LOG_DEBUG, "FW: Failed to send message to %d CTX: %p\n",
+		log_printf(LOG_DEBUG, "FW: Failed to send message to %d CTX: %p\n",
 		       target, ctx);
 		goto out_fail;
 	}
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index 0edd3b4..659a9bd 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -11,7 +11,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <resgroup.h>
-#include <clulog.h>
+#include <logging.h>
 #include <lock.h>
 #include <rg_locks.h>
 #include <ccs.h>
@@ -121,13 +121,13 @@ svc_report_failure(char *svcName)
 	cluster_member_list_t *membership;
 
 	if (rg_lock(svcName, &lockp) == -1) {
-		clulog(LOG_ERR, "#41: Couldn't obtain lock for RG %s: %s\n",
+		log_printf(LOG_ERR, "#41: Couldn't obtain lock for RG %s: %s\n",
 		       svcName, strerror(errno));
 		return -1;
 	}
 
 	if (get_rg_state(svcName, &svcStatus) != 0) {
-		clulog(LOG_ERR, "#42: Couldn't obtain status for RG %s\n",
+		log_printf(LOG_ERR, "#42: Couldn't obtain status for RG %s\n",
 		       svcName);
 		rg_unlock(&lockp);
 		return -1;
@@ -137,19 +137,18 @@ svc_report_failure(char *svcName)
 	membership = member_list();
 	nodeName = memb_id_to_name(membership, svcStatus.rs_last_owner);
 	if (nodeName) {
-		clulog(LOG_ALERT, "#2: Service %s returned failure "
+		log_printf(LOG_ALERT, "#2: Service %s returned failure "
 		       "code.  Last Owner: %s\n", svcName, nodeName);
 	} else {
-		clulog(LOG_ALERT, "#3: Service %s returned failure "
+		log_printf(LOG_ALERT, "#3: Service %s returned failure "
 		       "code.  Last Owner: %d\n",
 		       svcName, (int)svcStatus.rs_last_owner);
 	}
 
 	free_member_list(membership);
 
-	clulog(LOG_ALERT,
-	       "#4: Administrator intervention required.\n",
-	       svcName, nodeName);
+	log_printf(LOG_ALERT,
+	       "#4: Administrator intervention required.\n");
 
 	return 0;
 }
@@ -173,7 +172,7 @@ rg_lock(char *name, struct dlm_lksb *p)
 int
 _rg_lock_dbg(char *name, struct dlm_lksb *p, char *file, int line)
 {
-	dprintf("rg_lock(%s) @ %s:%d\n", name, file, line);
+	dbg_printf("rg_lock(%s) @ %s:%d\n", name, file, line);
 	return _rg_lock(name, p);
 }
 #endif
@@ -194,7 +193,7 @@ rg_unlock(struct dlm_lksb *p)
 int
 _rg_unlock_dbg(struct dlm_lksb *p, char *file, int line)
 {
-	dprintf("rg_unlock() @ %s:%d\n", file, line);
+	dbg_printf("rg_unlock() @ %s:%d\n", file, line);
 	return _rg_unlock(p);
 }
 #endif
@@ -473,7 +472,7 @@ svc_advise_stop(rg_state_t *svcStatus, char *svcName, int req)
 	int ret = 0;
 	
 	if (svcStatus->rs_flags & RG_FLAG_FROZEN) {
-		clulog(LOG_DEBUG, "Service %s frozen.\n", svcName);
+		log_printf(LOG_DEBUG, "Service %s frozen.\n", svcName);
 		return 5;
 	}
 
@@ -509,7 +508,7 @@ svc_advise_stop(rg_state_t *svcStatus, char *svcName, int req)
 			}
 
 			/* Disable or relocate request here. */
-			clulog(LOG_DEBUG, "Forwarding req. to %s.\n",
+			log_printf(LOG_DEBUG, "Forwarding req. to %s.\n",
 			       memb_id_to_name(membership,
 					       svcStatus->rs_owner));
 			ret = 3;
@@ -541,7 +540,7 @@ svc_advise_stop(rg_state_t *svcStatus, char *svcName, int req)
 			ret = 1;
 			break;
 		}
-		clulog(LOG_DEBUG,
+		log_printf(LOG_DEBUG,
 		       "Not stopping %s: service is failed\n",
 		       svcName);
 		ret = 0;
@@ -558,7 +557,7 @@ svc_advise_stop(rg_state_t *svcStatus, char *svcName, int req)
 	case RG_STATE_DISABLED:
 	case RG_STATE_UNINITIALIZED:
 		if (req == RG_DISABLE) {
-			clulog(LOG_NOTICE,
+			log_printf(LOG_NOTICE,
 			       "Disabling disabled service %s\n",
 			       svcName);
 			ret = 1;
@@ -566,12 +565,12 @@ svc_advise_stop(rg_state_t *svcStatus, char *svcName, int req)
 		}
 
 		ret = 2;
-		clulog(LOG_DEBUG, "Not stopping disabled service %s\n",
+		log_printf(LOG_DEBUG, "Not stopping disabled service %s\n",
 		       svcName);
 		break;
 
 	default:
-		clulog(LOG_ERR,
+		log_printf(LOG_ERR,
 		       "#42: Cannot stop RG %s: Invalid State %d\n",
 		       svcName, svcStatus->rs_state);
 		break;
@@ -604,13 +603,13 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req)
 	int ret = 0;
 	
 	if (svcStatus->rs_flags & RG_FLAG_FROZEN) {
-		clulog(LOG_DEBUG, "Service %s frozen.\n", svcName);
+		log_printf(LOG_DEBUG, "Service %s frozen.\n", svcName);
 		return 5;
 	}
 
 	switch(svcStatus->rs_state) {
 	case RG_STATE_FAILED:
-		clulog(LOG_ERR,
+		log_printf(LOG_ERR,
 		       "#43: Service %s has failed; can not start.\n",
 		       svcName);
 		break;
@@ -626,7 +625,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req)
 		if (svcStatus->rs_owner == (uint32_t)my_id()) {
 		    	/*
 			 * Service is already running locally
-			clulog(LOG_DEBUG,
+			log_printf(LOG_DEBUG,
 			       "RG %s is already running locally\n", svcName);
 			 */
 			ret = 4;
@@ -637,7 +636,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req)
 		    memb_online(membership, svcStatus->rs_owner)) {
 			/*
 			 * Service is running and the owner is online!
-			clulog(LOG_DEBUG, "RG %s is running on member %s.\n",
+			log_printf(LOG_DEBUG, "RG %s is running on member %s.\n",
 			       svcName,
 			       memb_id_to_name(membership,svcStatus->rs_owner));
 			 */
@@ -653,7 +652,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req)
 				break;
 			}
 
-			clulog(LOG_NOTICE,
+			log_printf(LOG_NOTICE,
 			       "Starting stopped service%s\n",
 			       svcName);
 			ret = 1;
@@ -661,7 +660,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req)
 		}
 
 		if (rg_locked()) {
-			clulog(LOG_WARNING, "Not initiating failover of %s: "
+			log_printf(LOG_WARNING, "Not initiating failover of %s: "
 			       "Resource groups locked!\n", svcName);
 			ret = 3;
 			break;
@@ -670,7 +669,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req)
 		/*
 		 * Service is running but owner is down -> RG_EFAILOVER
 		 */
-		clulog(LOG_NOTICE,
+		log_printf(LOG_NOTICE,
 		       "Taking over service %s from down member %s\n",
 		       svcName, memb_id_to_name(membership,
 						svcStatus->rs_owner));
@@ -682,7 +681,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req)
 		 * Starting failed service...
 		 */
 		if (req == RG_START_RECOVER || central_events_enabled()) {
-			clulog(LOG_NOTICE,
+			log_printf(LOG_NOTICE,
 			       "Recovering failed service %s\n",
 			       svcName);
 			svcStatus->rs_state = RG_STATE_STOPPED;
@@ -692,7 +691,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req)
 		}
 
 		/* Don't start, but return success. */
-		clulog(LOG_DEBUG,
+		log_printf(LOG_DEBUG,
 		       "Not starting %s: recovery state\n",
 		       svcName);
 		ret = 2;
@@ -706,7 +705,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req)
 			break;
 		}
 
-		clulog(LOG_NOTICE, "Starting stopped service %s\n",
+		log_printf(LOG_NOTICE, "Starting stopped service %s\n",
 		       svcName);
 		ret = 1;
 		break;
@@ -720,7 +719,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req)
 				break;
 			}
 
-			clulog(LOG_NOTICE,
+			log_printf(LOG_NOTICE,
 			       "Starting disabled service %s\n",
 			       svcName);
 			ret = 1;
@@ -731,12 +730,12 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req)
 			break;
 		}
 
-		clulog(LOG_DEBUG, "Not starting disabled RG %s\n",
+		log_printf(LOG_DEBUG, "Not starting disabled RG %s\n",
 		       svcName);
 		break;
 
 	default:
-		clulog(LOG_ERR,
+		log_printf(LOG_ERR,
 		       "#44: Cannot start RG %s: Invalid State %d\n",
 		       svcName, svcStatus->rs_state);
 		break;
@@ -763,14 +762,14 @@ svc_start(char *svcName, int req)
 	rg_state_t svcStatus;
 
 	if (rg_lock(svcName, &lockp) < 0) {
-		clulog(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
+		log_printf(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
 		       strerror(errno));
 		return RG_EFAIL;
 	}
 
 	if (get_rg_state(svcName, &svcStatus) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_ERR, "#46: Failed getting status for RG %s\n",
+		log_printf(LOG_ERR, "#46: Failed getting status for RG %s\n",
 		       svcName);
 		return RG_EFAIL;
 	}
@@ -808,7 +807,7 @@ svc_start(char *svcName, int req)
 		svcStatus.rs_restarts = 0;
 
 	if (set_rg_state(svcName, &svcStatus) < 0) {
-		clulog(LOG_ERR,
+		log_printf(LOG_ERR,
 		       "#47: Failed changing service status\n");
 		rg_unlock(&lockp);
 		return RG_EFAIL;
@@ -821,14 +820,14 @@ svc_start(char *svcName, int req)
 			cute values scripts might return */
 
 	if (rg_lock(svcName, &lockp) < 0) {
-		clulog(LOG_ERR, "#74: Unable to obtain cluster lock: %s\n",
+		log_printf(LOG_ERR, "#74: Unable to obtain cluster lock: %s\n",
 		       strerror(errno));
 		return RG_EFAIL;
 	}
 
 	svcStatus.rs_state = RG_STATE_STARTED;
 	if (set_rg_state(svcName, &svcStatus) != 0) {
-		clulog(LOG_ERR,
+		log_printf(LOG_ERR,
 		       "#75: Failed changing service status\n");
 		rg_unlock(&lockp);
 		return RG_EFAIL;
@@ -836,14 +835,14 @@ svc_start(char *svcName, int req)
 	rg_unlock(&lockp);
        
 	if (ret == 0) {
-		clulog(LOG_NOTICE,
+		log_printf(LOG_NOTICE,
 		       "Service %s started\n",
 		       svcName);
 
 		broadcast_event(svcName, RG_STATE_STARTED, svcStatus.rs_owner,
 				svcStatus.rs_last_owner);
 	} else {
-		clulog(LOG_WARNING,
+		log_printf(LOG_WARNING,
 		       "#68: Failed to start %s; return value: %d\n",
 		       svcName, ret);
 	}
@@ -883,14 +882,14 @@ svc_migrate(char *svcName, int target)
 	free_member_list(membership);
 
 	if (rg_lock(svcName, &lockp) < 0) {
-		clulog(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
+		log_printf(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
 		       strerror(errno));
 		return RG_EFAIL;
 	}
 
 	if (get_rg_state(svcName, &svcStatus) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_ERR, "#46: Failed getting status for RG %s\n",
+		log_printf(LOG_ERR, "#46: Failed getting status for RG %s\n",
 		       svcName);
 		return RG_EFAIL;
 	}
@@ -928,7 +927,7 @@ svc_migrate(char *svcName, int target)
 	svcStatus.rs_transition = (uint64_t)time(NULL);
 
 	if (set_rg_state(svcName, &svcStatus) != 0) {
-		clulog(LOG_ERR,
+		log_printf(LOG_ERR,
 		       "#75: Failed changing service status\n");
 		rg_unlock(&lockp);
 		return RG_EFAIL;
@@ -966,14 +965,14 @@ svc_migrate(char *svcName, int target)
 	   services are ... well, migratable, we can just flip the state
 	   back to 'started' and error checking will fix it later. */
 	if (rg_lock(svcName, &lockp) < 0) {
-		clulog(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
+		log_printf(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
 		       strerror(errno));
 		return ret;
 	}
 
 	if (get_rg_state(svcName, &svcStatus) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_ERR, "#46: Failed getting status for RG %s\n",
+		log_printf(LOG_ERR, "#46: Failed getting status for RG %s\n",
 		       svcName);
 		return ret;
 	}
@@ -1083,24 +1082,24 @@ msvc_check_cluster(char *svcName)
 
 	newowner = get_new_owner(svcName);
 	if (newowner < 0) {
-		clulog(LOG_DEBUG, "No other nodes have seen %s\n", svcName);
+		log_printf(LOG_DEBUG, "No other nodes have seen %s\n", svcName);
 		return -1;
 	}
 
 	/* New owner found */
-	clulog(LOG_NOTICE, "Migration: %s is running on %d\n", svcName, newowner);
+	log_printf(LOG_NOTICE, "Migration: %s is running on %d\n", svcName, newowner);
 
 	/* If the check succeeds (returns 0), then flip the state back to
 	   'started' - with a new owner */
 	if (rg_lock(svcName, &lockp) < 0) {
-		clulog(LOG_ERR, "#451: Unable to obtain cluster lock: %s\n",
+		log_printf(LOG_ERR, "#451: Unable to obtain cluster lock: %s\n",
 			strerror(errno));
 		return -1;
 	}
 
 	if (get_rg_state(svcName, &svcStatus) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_ERR, "#452: Failed getting status for RG %s\n",
+		log_printf(LOG_ERR, "#452: Failed getting status for RG %s\n",
 		       svcName);
 		return -1;
 	}
@@ -1110,7 +1109,7 @@ msvc_check_cluster(char *svcName)
 
 	if (set_rg_state(svcName, &svcStatus) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_ERR, "#453: Failed setting status for RG %s\n",
+		log_printf(LOG_ERR, "#453: Failed setting status for RG %s\n",
 		       svcName);
 		return -1;
 	}
@@ -1134,14 +1133,14 @@ svc_status(char *svcName)
 	int ret;
 
 	if (rg_lock(svcName, &lockp) < 0) {
-		clulog(LOG_ERR, "#48: Unable to obtain cluster lock: %s\n",
+		log_printf(LOG_ERR, "#48: Unable to obtain cluster lock: %s\n",
 		       strerror(errno));
 		return RG_EFAIL;
 	}
 
 	if (get_rg_state(svcName, &svcStatus) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_ERR, "#49: Failed getting status for RG %s\n",
+		log_printf(LOG_ERR, "#49: Failed getting status for RG %s\n",
 		       svcName);
 		return RG_EFAIL;
 	}
@@ -1187,7 +1186,7 @@ handle_started_status(char *svcName, int ret,
 	   inline recovery */
 	if (ret & SFL_RECOVERABLE) {
 
-		clulog(LOG_WARNING, "Some independent resources in %s failed; "
+		log_printf(LOG_WARNING, "Some independent resources in %s failed; "
 		       "Attempting inline recovery\n", svcName);
 
 		ret = group_op(svcName, RG_CONDSTOP);
@@ -1196,10 +1195,10 @@ handle_started_status(char *svcName, int ret,
 		}
 
 		if (ret) {
-			clulog(LOG_WARNING, "Inline recovery of %s failed\n",
+			log_printf(LOG_WARNING, "Inline recovery of %s failed\n",
 			       svcName);
 		} else {
-			clulog(LOG_NOTICE,
+			log_printf(LOG_NOTICE,
 			       "Inline recovery of %s succeeded\n",
 			       svcName);
 			return 0;
@@ -1223,7 +1222,7 @@ handle_migrate_status(char *svcName, int ret, rg_state_t *svcStatus)
 	/* If the check succeeds (returns 0), then flip the state back to
 	   'started' - we now own the service */
 	if (rg_lock(svcName, &lockp) < 0) {
-		clulog(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
+		log_printf(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
 			strerror(errno));
 		return RG_EFAIL;
 	}
@@ -1231,13 +1230,13 @@ handle_migrate_status(char *svcName, int ret, rg_state_t *svcStatus)
 	svcStatus->rs_state = RG_STATE_STARTED;
 	if (set_rg_state(svcName, svcStatus) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_ERR, "#46: Failed getting status for RG %s\n",
+		log_printf(LOG_ERR, "#46: Failed getting status for RG %s\n",
 		       svcName);
 		return RG_EFAIL;
 	}
 	rg_unlock(&lockp);
 
-	clulog(LOG_NOTICE, "%s is now running locally\n", svcName);
+	log_printf(LOG_NOTICE, "%s is now running locally\n", svcName);
 
 	return 0;
 }
@@ -1249,7 +1248,7 @@ svc_status_inquiry(char *svcName)
 	rg_state_t svcStatus;
 
 	if (get_rg_state_local(svcName, &svcStatus) != 0) {
-		clulog(LOG_ERR, "Failed getting local status for RG %s\n",
+		log_printf(LOG_ERR, "Failed getting local status for RG %s\n",
 		       svcName);
 		return RG_EFAIL;
 	}
@@ -1278,20 +1277,20 @@ _svc_stop(char *svcName, int req, int recover, uint32_t newstate)
 	int old_state;
 
 	if (!rg_quorate()) {
-		clulog(LOG_WARNING, "#69: Unclean %s of %s\n", 
+		log_printf(LOG_WARNING, "#69: Unclean %s of %s\n", 
 		       rg_req_str(req), svcName);
 		return group_op(svcName, RG_STOP);
 	}
 
 	if (rg_lock(svcName, &lockp) == RG_EFAIL) {
-		clulog(LOG_ERR, "#50: Unable to obtain cluster lock: %s\n",
+		log_printf(LOG_ERR, "#50: Unable to obtain cluster lock: %s\n",
 		       strerror(errno));
 		return RG_EFAIL;
 	}
 
 	if (get_rg_state(svcName, &svcStatus) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_ERR, "#51: Failed getting status for RG %s\n",
+		log_printf(LOG_ERR, "#51: Failed getting status for RG %s\n",
 		       svcName);
 		return RG_EFAIL;
 	}
@@ -1299,7 +1298,7 @@ _svc_stop(char *svcName, int req, int recover, uint32_t newstate)
 	switch (svc_advise_stop(&svcStatus, svcName, req)) {
 	case 0:
 		rg_unlock(&lockp);
-		clulog(LOG_DEBUG, "Unable to stop RG %s in %s state\n",
+		log_printf(LOG_DEBUG, "Unable to stop RG %s in %s state\n",
 		       svcName, rg_state_str(svcStatus.rs_state));
 		return RG_EFAIL;
 	case 6:
@@ -1330,7 +1329,7 @@ _svc_stop(char *svcName, int req, int recover, uint32_t newstate)
 
 	old_state = svcStatus.rs_state;
 
-	clulog(LOG_NOTICE, "Stopping service %s\n", svcName);
+	log_printf(LOG_NOTICE, "Stopping service %s\n", svcName);
 
 	if (recover) 
 	       	svcStatus.rs_state = RG_STATE_ERROR;
@@ -1342,7 +1341,7 @@ _svc_stop(char *svcName, int req, int recover, uint32_t newstate)
 
 	if (set_rg_state(svcName, &svcStatus) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_ERR, "#52: Failed changing RG status\n");
+		log_printf(LOG_ERR, "#52: Failed changing RG status\n");
 		return RG_EFAIL;
 	}
 	rg_unlock(&lockp);
@@ -1351,7 +1350,7 @@ _svc_stop(char *svcName, int req, int recover, uint32_t newstate)
 
 	if (old_state == RG_STATE_FAILED && newstate == RG_STATE_DISABLED) {
 		if (ret)
-			clulog(LOG_ALERT, "Marking %s as 'disabled', "
+			log_printf(LOG_ALERT, "Marking %s as 'disabled', "
 			       "but some resources may still be allocated!\n",
 			       svcName);
 		_svc_stop_finish(svcName, 0, newstate);
@@ -1370,14 +1369,14 @@ _svc_stop_finish(char *svcName, int failed, uint32_t newstate)
 	struct dlm_lksb lockp;
 
 	if (rg_lock(svcName, &lockp) == RG_EFAIL) {
-		clulog(LOG_ERR, "#53: Unable to obtain cluster lock: %s\n",
+		log_printf(LOG_ERR, "#53: Unable to obtain cluster lock: %s\n",
 		       strerror(errno));
 		return RG_EFAIL;
 	}
 
 	if (get_rg_state(svcName, &svcStatus) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_ERR, "#54: Failed getting status for RG %s\n",
+		log_printf(LOG_ERR, "#54: Failed getting status for RG %s\n",
 		       svcName);
 		return RG_EFAIL;
 	}
@@ -1393,7 +1392,7 @@ _svc_stop_finish(char *svcName, int failed, uint32_t newstate)
 	svcStatus.rs_owner = 0;
 
 	if (failed) {
-		clulog(LOG_CRIT, "#12: RG %s failed to stop; intervention "
+		log_printf(LOG_CRIT, "#12: RG %s failed to stop; intervention "
 		       "required\n", svcName);
 		newstate = RG_STATE_FAILED;
 	} else if (svcStatus.rs_state == RG_STATE_ERROR) {
@@ -1403,14 +1402,14 @@ _svc_stop_finish(char *svcName, int failed, uint32_t newstate)
 
 	svcStatus.rs_state = newstate;
 
-	clulog(LOG_NOTICE, "Service %s is %s\n", svcName,
+	log_printf(LOG_NOTICE, "Service %s is %s\n", svcName,
 	       rg_state_str(svcStatus.rs_state));
 	//printf("rg state = %s\n", rg_state_str(svcStatus.rs_state));
 
 	svcStatus.rs_transition = (uint64_t)time(NULL);
 	if (set_rg_state(svcName, &svcStatus) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_ERR, "#55: Failed changing RG status\n");
+		log_printf(LOG_ERR, "#55: Failed changing RG status\n");
 		return RG_EFAIL;
 	}
 	rg_unlock(&lockp);
@@ -1457,16 +1456,16 @@ svc_fail(char *svcName)
 	rg_state_t svcStatus;
 
 	if (rg_lock(svcName, &lockp) == RG_EFAIL) {
-		clulog(LOG_ERR, "#55: Unable to obtain cluster lock: %s\n",
+		log_printf(LOG_ERR, "#55: Unable to obtain cluster lock: %s\n",
 		       strerror(errno));
 		return RG_EFAIL;
 	}
 
-	clulog(LOG_DEBUG, "Handling failure request for RG %s\n", svcName);
+	log_printf(LOG_DEBUG, "Handling failure request for RG %s\n", svcName);
 
 	if (get_rg_state(svcName, &svcStatus) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_ERR, "#56: Failed getting status for RG %s\n",
+		log_printf(LOG_ERR, "#56: Failed getting status for RG %s\n",
 		       svcName);
 		return RG_EFAIL;
 	}
@@ -1474,7 +1473,7 @@ svc_fail(char *svcName)
 	if ((svcStatus.rs_state == RG_STATE_STARTED) &&
 	    (svcStatus.rs_owner != (uint32_t)my_id())) {
 		rg_unlock(&lockp);
-		clulog(LOG_DEBUG, "Unable to disable RG %s in %s state\n",
+		log_printf(LOG_DEBUG, "Unable to disable RG %s in %s state\n",
 		       svcName, rg_state_str(svcStatus.rs_state));
 		return RG_EFAIL;
 	}
@@ -1491,7 +1490,7 @@ svc_fail(char *svcName)
 	svcStatus.rs_restarts = 0;
 	if (set_rg_state(svcName, &svcStatus) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_ERR, "#57: Failed changing RG status\n");
+		log_printf(LOG_ERR, "#57: Failed changing RG status\n");
 		return RG_EFAIL;
 	}
 	rg_unlock(&lockp);
@@ -1515,17 +1514,17 @@ _svc_freeze(char *svcName, int enabled)
 	rg_state_t svcStatus;
 
 	if (rg_lock(svcName, &lockp) == RG_EFAIL) {
-		clulog(LOG_ERR, "#55: Unable to obtain cluster lock: %s\n",
+		log_printf(LOG_ERR, "#55: Unable to obtain cluster lock: %s\n",
 		       strerror(errno));
 		return RG_EFAIL;
 	}
 
-	clulog(LOG_DEBUG, "Handling %s request for RG %s\n", enabled?"freeze":"unfreeze",
+	log_printf(LOG_DEBUG, "Handling %s request for RG %s\n", enabled?"freeze":"unfreeze",
 	       svcName);
 
 	if (get_rg_state(svcName, &svcStatus) != 0) {
 		rg_unlock(&lockp);
-		clulog(LOG_ERR, "#56: Failed getting status for RG %s\n",
+		log_printf(LOG_ERR, "#56: Failed getting status for RG %s\n",
 		       svcName);
 		return RG_EFAIL;
 	}
@@ -1536,16 +1535,16 @@ _svc_freeze(char *svcName, int enabled)
 	case RG_STATE_DISABLED:
 
 		if (enabled == 1) {
-			clulog(LOG_DEBUG, "Freezing RG %s\n", svcName);
+			log_printf(LOG_DEBUG, "Freezing RG %s\n", svcName);
 			svcStatus.rs_flags |= RG_FLAG_FROZEN;
 		} else {
-			clulog(LOG_DEBUG, "Unfreezing RG %s\n", svcName);
+			log_printf(LOG_DEBUG, "Unfreezing RG %s\n", svcName);
 			svcStatus.rs_flags &= ~RG_FLAG_FROZEN;
 		}
 
 		if (set_rg_state(svcName, &svcStatus) != 0) {
 			rg_unlock(&lockp);
-			clulog(LOG_ERR, "#57: Failed changing RG status\n");
+			log_printf(LOG_ERR, "#57: Failed changing RG status\n");
 			return RG_EFAIL;
 		}
 		break;
@@ -1599,7 +1598,7 @@ svc_start_remote(char *svcName, int request, uint32_t target)
 	/* Open a connection to the other node */
 
 	if (msg_open(MSG_CLUSTER, target, RG_PORT, &ctx, 2)< 0) {
-		clulog(LOG_ERR,
+		log_printf(LOG_ERR,
 		       "#58: Failed opening connection to member #%d\n",
 		       target);
 		return -1;
@@ -1611,14 +1610,14 @@ svc_start_remote(char *svcName, int request, uint32_t target)
 	/* Send relocate message to the other node */
 	if (msg_send(&ctx, &msg_relo, sizeof (SmMessageSt)) < 
 	    (int)sizeof (SmMessageSt)) {
-		clulog(LOG_ERR,
+		log_printf(LOG_ERR,
 		       "#59: Error sending remote-start request to member #%d\n",
 		       target);
 		msg_close(&ctx);
 		return -1;
 	}
 
-	clulog(LOG_DEBUG, "Sent remote-start request to %d\n", (int)target);
+	log_printf(LOG_DEBUG, "Sent remote-start request to %d\n", (int)target);
 
 	/* Check the response */
 	do {
@@ -1633,7 +1632,7 @@ svc_start_remote(char *svcName, int request, uint32_t target)
 		/* Check to see if resource groups are locked for local
 		   shutdown */
 		if (rg_locked()) {
-			clulog(LOG_WARNING,
+			log_printf(LOG_WARNING,
 			       "#XX: Cancelling relocation: Shutting down\n");
 			msg_close(&ctx);
 			return RG_NO;
@@ -1645,7 +1644,7 @@ svc_start_remote(char *svcName, int request, uint32_t target)
 			free_member_list(ml);
 			continue;
 		}
-		clulog(LOG_WARNING,
+		log_printf(LOG_WARNING,
 		       "#XX: Cancelling relocation: Target node down\n");
 		free_member_list(ml);
 		msg_close(&ctx);
@@ -1657,7 +1656,7 @@ svc_start_remote(char *svcName, int request, uint32_t target)
 		 * In this case, we don't restart the service, because the 
 		 * service state is actually unknown to us at this time.
 		 */
-		clulog(LOG_ERR, "#60: Mangled reply from member #%d during RG "
+		log_printf(LOG_ERR, "#60: Mangled reply from member #%d during RG "
 		       "relocate\n", target);
 		msg_close(&ctx);
 		return 0;	/* XXX really UNKNOWN */
@@ -1844,19 +1843,19 @@ handle_relocate_req(char *svcName, int request, int preferred_target,
 			return RG_EFAIL;
 		default:
 			/* deliberate fallthrough */
-			clulog(LOG_ERR,
+			log_printf(LOG_ERR,
 			       "#61: Invalid reply from member %d during"
 			       " relocate operation!\n", target);
 		case RG_NO:
 			/* state uncertain */
 			free_member_list(allowed_nodes);
-			clulog(LOG_CRIT, "State Uncertain: svc:%s "
+			log_printf(LOG_CRIT, "State Uncertain: svc:%s "
 			       "nid:%d req:%s ret:%d\n", svcName,
 			       target, rg_req_str(request), ret);
 			return 0;
 		case 0:
 			*new_owner = target;
-			clulog(LOG_NOTICE, "Service %s is now running "
+			log_printf(LOG_NOTICE, "Service %s is now running "
 			       "on member %d\n", svcName, (int)target);
 			free_member_list(allowed_nodes);
 			return 0;
@@ -1879,7 +1878,7 @@ handle_relocate_req(char *svcName, int request, int preferred_target,
 	 */
 exhausted:
 	if (!rg_locked()) {
-		clulog(LOG_WARNING,
+		log_printf(LOG_WARNING,
 		       "#70: Failed to relocate %s; restarting locally\n",
 		       svcName);
 		if (svc_start(svcName, RG_START_RECOVER) == 0) {
@@ -1990,9 +1989,9 @@ handle_start_req(char *svcName, int req, int *new_owner)
 	 * Keep the state open so the other nodes don't try to start
 	 * it.  This allows us to be the 'root' of a given service.
 	 */
-	clulog(LOG_DEBUG, "Stopping failed service %s\n", svcName);
+	log_printf(LOG_DEBUG, "Stopping failed service %s\n", svcName);
 	if (svc_stop(svcName, RG_STOP_RECOVER) != 0) {
-		clulog(LOG_CRIT,
+		log_printf(LOG_CRIT,
 		       "#13: Service %s failed to stop cleanly\n",
 		       svcName);
 		(void) svc_fail(svcName);
@@ -2012,7 +2011,7 @@ relocate:
 	 * we should relocate the service.
 	 */
 	if (actual_failure)
-		clulog(LOG_WARNING, "#71: Relocating failed service %s\n",
+		log_printf(LOG_WARNING, "#71: Relocating failed service %s\n",
 	       	       svcName);
 	ret = handle_relocate_req(svcName, RG_START_RECOVER, -1, new_owner);
 
@@ -2121,7 +2120,7 @@ handle_recover_req(char *svcName, int *new_owner)
 
 	/* Check restart counter/timer for this resource */
 	if (check_restart(svcName) > 0) {
-		clulog(LOG_NOTICE, "Restart threshold for %s exceeded; "
+		log_printf(LOG_NOTICE, "Restart threshold for %s exceeded; "
 		       "attempting to relocate\n", svcName);
 		return handle_relocate_req(svcName, RG_START_RECOVER, -1,
 					   new_owner);
@@ -2178,7 +2177,7 @@ handle_fd_start_req(char *svcName, int request, int *new_owner)
 			ret = RG_EFAIL;
 			goto out;
       		default:
-			clulog(LOG_ERR,
+			log_printf(LOG_ERR,
 	 		       "#6X: Invalid reply [%d] from member %d during"
 	  		       " relocate operation!\n", ret, target);
 	   	}
diff --git a/rgmanager/src/daemons/rg_thread.c b/rgmanager/src/daemons/rg_thread.c
index 8ba2474..51d8199 100644
--- a/rgmanager/src/daemons/rg_thread.c
+++ b/rgmanager/src/daemons/rg_thread.c
@@ -152,7 +152,7 @@ purge_all(request_t **list)
 	while((curr = *list)) {
 
 		list_remove(list, curr);
-		dprintf("Removed request %d\n", curr->rr_request);
+		dbg_printf("Removed request %d\n", curr->rr_request);
 		if (curr->rr_resp_ctx) {
 			send_response(RG_EABORT, 0, curr);
 			msg_close(curr->rr_resp_ctx);
@@ -178,7 +178,7 @@ resgroup_thread_main(void *arg)
 	rg_inc_threads();
 
 	strncpy(myname, arg, 256);
-	dprintf("Thread %s (tid %d) starting\n",myname,gettid());
+	dbg_printf("Thread %s (tid %d) starting\n",myname,gettid());
 
 	pthread_mutex_init(&my_queue_mutex, NULL);
 	pthread_mutex_lock(&my_queue_mutex);
@@ -227,7 +227,7 @@ resgroup_thread_main(void *arg)
 		ret = RG_FAIL;
 		error = 0;
 
-		dprintf("Processing request %s, resource group %s\n",
+		dbg_printf("Processing request %s, resource group %s\n",
 			rg_req_str(req->rr_request), myname);
 
 		/* find ourselves. */
@@ -498,7 +498,7 @@ resgroup_thread_main(void *arg)
 	myself = find_resthread_byname(myname);
 
 	if (!myself) {
-		dprintf("I don't exist...\n");
+		dbg_printf("I don't exist...\n");
 		raise(SIGSEGV);
 	}
 
@@ -523,7 +523,7 @@ resgroup_thread_main(void *arg)
 
 	pthread_mutex_unlock(&reslist_mutex);
 
-	dprintf("RGth %s (tid %d): No more requests"
+	dbg_printf("RGth %s (tid %d): No more requests"
 		"; exiting.\n", myname, gettid());
 
 	/* Thread's outta here */
@@ -722,7 +722,7 @@ rt_enqueue_request(const char *resgroupname, int request,
 	if (ret < 0)
 		return ret;
 
-	dprintf("Queued request for %d for %s\n", request, resgroupname);
+	dbg_printf("Queued request for %d for %s\n", request, resgroupname);
 	
 	return 0;	
 }
diff --git a/rgmanager/src/daemons/service_op.c b/rgmanager/src/daemons/service_op.c
index 855975f..1302042 100644
--- a/rgmanager/src/daemons/service_op.c
+++ b/rgmanager/src/daemons/service_op.c
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <resgroup.h>
-#include <clulog.h>
+#include <logging.h>
 #include <lock.h>
 #include <rg_locks.h>
 #include <ccs.h>
@@ -72,19 +72,19 @@ service_op_start(char *svcName,
 			return RG_EFAIL;
 		default:
 			/* deliberate fallthrough */
-			clulog(LOG_ERR,
+			log_printf(LOG_ERR,
 			       "#61: Invalid reply from member %d during"
 			       " start operation!\n", target);
 		case RG_NO:
 			/* state uncertain */
-			clulog(LOG_CRIT, "State Uncertain: svc:%s "
+			log_printf(LOG_CRIT, "State Uncertain: svc:%s "
 			       "nid:%d req:%s ret:%d\n", svcName,
 			       target, rg_req_str(RG_START_REMOTE), ret);
 			return 0;
 		case 0:
 			if (new_owner)
 				*new_owner = target;
-			clulog(LOG_NOTICE, "Service %s is now running "
+			log_printf(LOG_NOTICE, "Service %s is now running "
 			       "on member %d\n", svcName, (int)target);
 			return 0;
 		}
@@ -96,7 +96,7 @@ service_op_start(char *svcName,
 	else if (dep == target_list_len)
 		ret = RG_EDEPEND;
 
-	clulog(LOG_INFO, "Start failed; node reports: %d failures, "
+	log_printf(LOG_INFO, "Start failed; node reports: %d failures, "
 	       "%d exclusive, %d dependency errors\n", fail, excl, dep);
 	return ret;
 }
@@ -146,7 +146,7 @@ service_op_stop(char *svcName, int do_disable, int event_type)
 	}
 
 	if (msg_open(MSG_CLUSTER, msgtarget, RG_PORT, &ctx, 2)< 0) {
-		clulog(LOG_ERR,
+		log_printf(LOG_ERR,
 		       "#58: Failed opening connection to member #%d\n",
 		       my_id());
 		return -1;
@@ -158,7 +158,7 @@ service_op_stop(char *svcName, int do_disable, int event_type)
 	/* Send stop message to the other node */
 	if (msg_send(&ctx, &msg, sizeof (SmMessageSt)) < 
 	    (int)sizeof (SmMessageSt)) {
-		clulog(LOG_ERR, "Failed to send complete message\n");
+		log_printf(LOG_ERR, "Failed to send complete message\n");
 		msg_close(&ctx);
 		return -1;
 	}
@@ -174,7 +174,7 @@ service_op_stop(char *svcName, int do_disable, int event_type)
 	} while(1);
 
 	if (msg_ret != sizeof (SmMessageSt)) {
-		clulog(LOG_WARNING, "Strange response size: %d vs %d\n",
+		log_printf(LOG_WARNING, "Strange response size: %d vs %d\n",
 		       msg_ret, (int)sizeof(SmMessageSt));
 		return 0;	/* XXX really UNKNOWN */
 	}
diff --git a/rgmanager/src/daemons/slang_event.c b/rgmanager/src/daemons/slang_event.c
index 01fff05..cc98b0c 100644
--- a/rgmanager/src/daemons/slang_event.c
+++ b/rgmanager/src/daemons/slang_event.c
@@ -6,7 +6,7 @@
 #include <list.h>
 #include <restart_counter.h>
 #include <reslist.h>
-#include <clulog.h>
+#include <logging.h>
 #include <members.h>
 #include <assert.h>
 #include <event.h>
@@ -16,7 +16,7 @@
 #include <slang.h>
 #include <sys/syslog.h>
 #include <malloc.h>
-#include <clulog.h>
+#include <logging.h>
 #include <sets.h>
 
 static int __sl_initialized = 0;
@@ -780,7 +780,7 @@ array_to_string(char *buf, int buflen, int *array, int arraylen)
 
 /**
   Start at the end of the arg list and work backwards, prepending a string.
-  This does not support standard clulog / printf formattting; rather, we 
+  This does not support standard log_printf / printf formattting; rather, we 
   just allow integers / strings to be mixed on the stack, figure out the
   type, convert it to the right type, and prepend it on to our log message
 
@@ -789,7 +789,7 @@ array_to_string(char *buf, int buflen, int *array, int arraylen)
      ...
      LOG_EMERG
 
-  This matches up with clulog / syslog mappings in the var table; the above
+  This matches up with log_printf / syslog mappings in the var table; the above
   are constants in the S/Lang interpreter.  Any number of arguments may
   be provided.  Examples are:
 
@@ -803,7 +803,7 @@ array_to_string(char *buf, int buflen, int *array, int arraylen)
 
  */
 void
-sl_clulog(int level)
+sl_log_printf(int level)
 {
 	int t, nargs, len;
 	//int level;
@@ -868,7 +868,7 @@ sl_clulog(int level)
 #if 0
 	printf("<%d> %s\n", level, &logbuf[remain]);
 #endif
-	clulog(level, &logbuf[remain]);
+	log_printf(level, "%s", &logbuf[remain]);
 	return;
 }
 
@@ -877,56 +877,56 @@ sl_clulog(int level)
 void
 sl_log_debug(void)
 {
-	sl_clulog(LOG_DEBUG);
+	sl_log_printf(LOG_DEBUG);
 }
 
 
 void
 sl_log_info(void)
 {
-	sl_clulog(LOG_INFO);
+	sl_log_printf(LOG_INFO);
 }
 
 
 void
 sl_log_notice(void)
 {
-	sl_clulog(LOG_NOTICE);
+	sl_log_printf(LOG_NOTICE);
 }
 
 
 void
 sl_log_warning(void)
 {
-	sl_clulog(LOG_WARNING);
+	sl_log_printf(LOG_WARNING);
 }
 
 
 void
 sl_log_err(void)
 {
-	sl_clulog(LOG_ERR);
+	sl_log_printf(LOG_ERR);
 }
 
 
 void
 sl_log_crit(void)
 {
-	sl_clulog(LOG_CRIT);
+	sl_log_printf(LOG_CRIT);
 }
 
 
 void
 sl_log_alert(void)
 {
-	sl_clulog(LOG_ALERT);
+	sl_log_printf(LOG_ALERT);
 }
 
 
 void
 sl_log_emerg(void)
 {
-	sl_clulog(LOG_EMERG);
+	sl_log_printf(LOG_EMERG);
 }
 
 
@@ -985,7 +985,7 @@ rgmanager_slang_error_hook(char *errstr)
 	/* Don't just send errstr, because it might contain
 	   "%s" for example which would result in a crash!
 	   plus, we like the newline :) */
-	clulog(LOG_ERR, "[S/Lang] %s\n", errstr);
+	log_printf(LOG_ERR, "[S/Lang] %s\n", errstr);
 }
 
 
@@ -1033,7 +1033,7 @@ do_slang_run(const char *file, const char *script)
 		ret = SLang_load_string((char *)script);
 
 	if (ret < 0) {
-		clulog(LOG_ERR, "[S/Lang] Script Execution Failure\n");
+		log_printf(LOG_ERR, "[S/Lang] Script Execution Failure\n");
 		SLang_restart(1);
 	}
 
diff --git a/rgmanager/src/daemons/test.c b/rgmanager/src/daemons/test.c
index 5d236fe..26033b6 100644
--- a/rgmanager/src/daemons/test.c
+++ b/rgmanager/src/daemons/test.c
@@ -10,6 +10,7 @@
 #include <restart_counter.h>
 #include <reslist.h>
 #include <pthread.h>
+#include <libgen.h>
 #include <depends.h>
 #include <event.h>
 
diff --git a/rgmanager/src/daemons/watchdog.c b/rgmanager/src/daemons/watchdog.c
index 767c3f3..45ced24 100644
--- a/rgmanager/src/daemons/watchdog.c
+++ b/rgmanager/src/daemons/watchdog.c
@@ -5,7 +5,7 @@
 #include <stdlib.h>
 
 #include <signals.h>
-#include <clulog.h>
+#include <logging.h>
 
 static pid_t child = 0;
 
@@ -60,15 +60,15 @@ watchdog_init(void)
 		
 		if (WIFSIGNALED(status)) {
 		        if (WTERMSIG(status) == SIGKILL) {
-				clulog(LOG_CRIT, "Watchdog: Daemon killed, exiting\n");
+				log_printf(LOG_CRIT, "Watchdog: Daemon killed, exiting\n");
 				raise(SIGKILL);
 				while(1) ;
 			}
 			else {
 #ifdef DEBUG
-			        clulog(LOG_CRIT, "Watchdog: Daemon died, but not rebooting because DEBUG is set\n");
+			        log_printf(LOG_CRIT, "Watchdog: Daemon died, but not rebooting because DEBUG is set\n");
 #else
-				clulog(LOG_CRIT, "Watchdog: Daemon died, rebooting...\n");
+				log_printf(LOG_CRIT, "Watchdog: Daemon died, rebooting...\n");
 				sync();
 			        reboot(RB_AUTOBOOT);
 #endif
diff --git a/rgmanager/src/utils/Makefile b/rgmanager/src/utils/Makefile
index 2bbfc44..bcf0832 100644
--- a/rgmanager/src/utils/Makefile
+++ b/rgmanager/src/utils/Makefile
@@ -2,7 +2,7 @@ TARGET1= clubufflush
 TARGET2= clufindhostname
 TARGET3= clustat
 TARGET4= clusvcadm
-TARGET5= clulog
+TARGET5= #clulog
 TARGET6= clunfslock
 
 SBINDIRT=$(TARGET1) $(TARGET2) $(TARGET3) $(TARGET4) $(TARGET5) $(TARGET6)
@@ -28,7 +28,7 @@ LDFLAGS += -L${libdir}
 LDDEPS += ../clulib/libclulib.a
 
 CCS_LDFLAGS += -L${ccslibdir} -lccs
-CMAN_LDFLAGS += -L${cmanlibdir} -lcman
+CMAN_LDFLAGS += -L${cmanlibdir} -lcman -llogsys
 NCURSES_LDFLAGS += -L${ncurseslibdir} -lncurses
 PTHREAD_LDFLAGS += -lpthread 
 
diff --git a/rgmanager/src/utils/clubufflush.c b/rgmanager/src/utils/clubufflush.c
index 6de2d26..3eaed48 100644
--- a/rgmanager/src/utils/clubufflush.c
+++ b/rgmanager/src/utils/clubufflush.c
@@ -37,7 +37,7 @@ static const char *version __attribute__ ((unused)) = "$Revision$";
 /*
  * Cluster includes
  */
-#include <clulog.h>
+#include <logging.h>
 
 /***************************************************************************
  *
@@ -53,7 +53,7 @@ static const char *version __attribute__ ((unused)) = "$Revision$";
 static void
 printUsage(char *progName)
 {
-	clulog_and_print(LOG_ERR, "Usage: %s [-h] [-f device]\n", progName);
+	printf("Usage: %s [-h] [-f device]\n", progName);
 }
 
 /***************************************************************************
@@ -72,8 +72,7 @@ main(int argc, char **argv)
 	uid=getuid();
 	if (uid)
 	  {
-	    clulog_and_print(LOG_ERR, "%s should only be run as user root\n",
-	            argv[0]);
+	    printf("%s should only be run as user root\n", argv[0]);
 	    exit(1);
 	  }
 
@@ -105,15 +104,14 @@ main(int argc, char **argv)
 
 	if (fd < 0)
 	  {
-	    clulog_and_print(LOG_ERR, "Cannot open %s for flushing: %s\n",
+	    printf("Cannot open %s for flushing: %s\n",
 	            devicename, strerror(errno));
 	    exit(1);
 	  }
 
 	if (ioctl(fd, BLKFLSBUF, 0) < 0)
 	  {
-	    clulog_and_print(LOG_ERR, "Cannot flush %s: %s\n",
-	            devicename, strerror(errno));
+	    printf("Cannot flush %s: %s\n", devicename, strerror(errno));
 	    exit(1);
 	  }
 	free(devicename);
diff --git a/rgmanager/src/utils/clulog.c b/rgmanager/src/utils/clulog.c
index 36e7163..a40b699 100644
--- a/rgmanager/src/utils/clulog.c
+++ b/rgmanager/src/utils/clulog.c
@@ -9,7 +9,7 @@
 #include <getopt.h>
 #include <string.h>
 #include <sys/syslog.h>
-#include <clulog.h>
+#include <corosync/engine/logsys.h>
 #include <ccs.h>
 
 int configure_logging(int);
@@ -25,39 +25,6 @@ usage(char *progname)
 }
 
 
-/*
- * Configure logging based on data in cluster.conf
- */
-int
-configure_logging(int ccsfd)
-{
-	char *v;
-	char internal = 0;
-
-	if (ccsfd < 0) {
-		internal = 1;
-		ccsfd = ccs_connect();
-		if (ccsfd < 0)
-			return -1;
-	}
-
-	if (ccs_get(ccsfd, "/cluster/rm/@log_facility", &v) == 0) {
-		clu_set_facility(v);
-		free(v);
-	}
-
-	if (ccs_get(ccsfd, "/cluster/rm/@log_level", &v) == 0) {
-		clu_set_loglevel(atoi(v));
-		free(v);
-	}
-
-	if (internal)
-		ccs_disconnect(ccsfd);
-
-	return 0;
-}
-
-
 int
 main(int argc, char **argv)
 {
@@ -102,7 +69,7 @@ main(int argc, char **argv)
     logmsg = (char*)malloc(strlen(argv[argc-1])+2);
     if (logmsg == NULL) {
         fprintf(stderr,
-            "clulog: malloc fail err=%d\n", errno);
+            "log_printf: malloc fail err=%d\n", errno);
         exit(0);
     }
 
@@ -116,7 +83,7 @@ main(int argc, char **argv)
     	if (configure_logging(-1) < 0)
 		clu_set_loglevel(LOGLEVEL_DFLT);
     }
-    result = clulog_pid(severity, pid, progname, logmsg);
+    result = log_printf_pid(severity, pid, progname, logmsg);
     free(progname);
     return(result);
 }
diff --git a/rgmanager/src/utils/clunfsops.c b/rgmanager/src/utils/clunfsops.c
index 2ca3f76..d65c8db 100644
--- a/rgmanager/src/utils/clunfsops.c
+++ b/rgmanager/src/utils/clunfsops.c
@@ -55,7 +55,7 @@
 /*
  * Cluster include
  */
-#include <clulog.h>
+#include <logging.h>
 
 
 /* Forward routine declarations. */
@@ -102,7 +102,7 @@ main(int argc, char** argv)
 	int retval;
 
     	if (geteuid() != (uid_t)0) {
-          	clulog_and_print(LOG_ERR, "%s must be run as the root user.\n",
+          	log_printf_and_print(LOG_ERR, "%s must be run as the root user.\n",
                 	argv[0]);
         	exit(1);    
     	}
@@ -134,12 +134,12 @@ main(int argc, char** argv)
 		}
 	}
 	if (nfsSyscallNum == 0) {
-		clulog_and_print(LOG_ERR, "%s: No NFS syscall has been "
+		log_printf_and_print(LOG_ERR, "%s: No NFS syscall has been "
 				 "specified.\n",cmdname);
 		++errors;
 	}
 	if (deviceName == NULL) {
-		clulog_and_print(LOG_ERR, "%s: No device name has been "
+		log_printf_and_print(LOG_ERR, "%s: No device name has been "
 				 "specified.\n", cmdname);
 		++errors;
 	}
@@ -166,13 +166,13 @@ main(int argc, char** argv)
 	 */
 	retval = nfsctl(nfsSyscallNum, &nfsctlarg, NULL);
 	if (retval != 0) {
-		/* clulog_and_print calls syslog(), which modifies errno */
+		/* log_printf_and_print calls syslog(), which modifies errno */
 		errno_save = errno;
-		clulog_and_print(LOG_WARNING, "#72: %s: NFS syscall %s failed: "
+		log_printf_and_print(LOG_WARNING, "#72: %s: NFS syscall %s failed: "
 				 "%s.\n", cmdname, nfsSyscallString, 
 				 strerror(errno_save));
 		if (errno_save == EINVAL) {
-			clulog_and_print(LOG_WARNING,
+			log_printf_and_print(LOG_WARNING,
 				         "#73: %s: Kernel may not "
 					 "have NFS failover enhancements.\n",
 					 cmdname);
@@ -199,14 +199,14 @@ validateDevice(char *name) {
 	stat_ptr = &stat_st;
 
 	if (stat(name, stat_ptr) < 0) {
-		clulog_and_print(LOG_ERR, "%s: Unable to stat %s.\n", cmdname, name);
+		log_printf_and_print(LOG_ERR, "%s: Unable to stat %s.\n", cmdname, name);
 		return(1);
 	}
 	/*
 	 * Verify that its a block or character special file.
 	 */
 	if (S_ISBLK(stat_st.st_mode) == 0) {
-		clulog_and_print(LOG_ERR, "%s: %s is not a block special file.\n", cmdname, name);
+		log_printf_and_print(LOG_ERR, "%s: %s is not a block special file.\n", cmdname, name);
 		return(1);
 	}
 	return(0); // success


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-26 18:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-26 18:39 master - rgmanager: First pass at port to logsys Lon Hohberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).