[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] Cluster Project branch, master, updated. gfs-kernel_0_1_22-192-g73c8dfb



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=73c8dfbd5a5b1440ba31de983a95dd5c900747c6

The branch, master has been updated
       via  73c8dfbd5a5b1440ba31de983a95dd5c900747c6 (commit)
       via  0dcc8ce541c2fe776fb91c30635a90b737f7d30f (commit)
      from  acfe61e4b1edc65b69416ac06964a0831b50b50d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 73c8dfbd5a5b1440ba31de983a95dd5c900747c6
Author: Fabio M. Di Nitto <fdinitto redhat com>
Date:   Tue Apr 22 12:23:05 2008 +0200

    [CCS] Convert to logsys
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>

commit 0dcc8ce541c2fe776fb91c30635a90b737f7d30f
Author: Fabio M. Di Nitto <fdinitto redhat com>
Date:   Tue Apr 22 12:12:38 2008 +0200

    [CCS] libraries should never log
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>

-----------------------------------------------------------------------

Summary of changes:
 ccs/common/log.c         |   23 ---
 ccs/common/log.h         |   98 -------------
 ccs/daemon/Makefile      |    3 +-
 ccs/daemon/ccsd.c        |  179 +++++++++++++-----------
 ccs/daemon/cluster_mgr.c |  114 ++++++++--------
 ccs/daemon/cnx_mgr.c     |  338 +++++++++++++++++++++++-----------------------
 ccs/daemon/misc.c        |   30 +++--
 ccs/include/debug.h      |   11 +-
 ccs/lib/Makefile         |   11 +-
 ccs/lib/libccs.c         |   53 +-------
 10 files changed, 351 insertions(+), 509 deletions(-)
 delete mode 100644 ccs/common/log.c
 delete mode 100644 ccs/common/log.h

diff --git a/ccs/common/log.c b/ccs/common/log.c
deleted file mode 100644
index a9c70f1..0000000
--- a/ccs/common/log.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/******************************************************************************
-*******************************************************************************
-**
-**  Copyright (C) 2004 Red Hat, Inc.  All rights reserved.
-**  
-**  This copyrighted material is made available to anyone wishing to use,
-**  modify, copy, or redistribute it subject to the terms and conditions
-**  of the GNU General Public License v.2.
-**
-*******************************************************************************
-******************************************************************************/
-#include <syslog.h>
-
-int log_is_open = 0;
-
-void log_open(const char *ident, int option, int facility){
-  openlog(ident, option, facility);
-  log_is_open = 1;
-}
-
-void log_close(void){
-  log_is_open = 0;
-}
diff --git a/ccs/common/log.h b/ccs/common/log.h
deleted file mode 100644
index 29bb69d..0000000
--- a/ccs/common/log.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/******************************************************************************
-*******************************************************************************
-**
-**  Copyright (C) 2004 Red Hat, Inc.  All rights reserved.
-**  
-**  This copyrighted material is made available to anyone wishing to use,
-**  modify, copy, or redistribute it subject to the terms and conditions
-**  of the GNU General Public License v.2.
-**
-*******************************************************************************
-******************************************************************************/
-#ifndef __LOG_H__
-#define __LOG_H__
-
-#include <syslog.h>
-
-extern int log_is_open;
-
-void log_open(const char *ident, int option, int facility);
-void log_close(void);
-
-/* Note, messages will always be sent to syslog, but userland programs **
-** will have to close stdout, stderr if they don't want messages       **
-** printed to the controling terminal (as all good daemon's should).   */
-
-#ifdef DEBUG
-#define log_dbg(fmt, args...) { \
-    if(log_is_open){ \
-      syslog(LOG_DEBUG, "[%s:%d] " fmt , __FILE__ , __LINE__ , ## args ); \
-    }else { \
-      fprintf(stdout, "[%s:%d] " fmt , __FILE__ , __LINE__ , ## args ); \
-    } \
-}
-#else
-#define log_dbg(fmt, args...)
-#endif
-
-#define log_msg(fmt, args...)  {\
-    if(log_is_open){ \
-      syslog(LOG_NOTICE, fmt, ## args); \
-    }else { \
-      fprintf(stdout, fmt , ## args ); \
-    } \
-}
-
-#ifdef DEBUG
-#define log_err(fmt, args...){ \
-    if(log_is_open){ \
-      syslog(LOG_ERR, "[%s:%d] " fmt , __FILE__ , __LINE__ , ## args ); \
-    }else { \
-      fprintf(stderr, "[%s:%d] ", __FILE__ , __LINE__); \
-      fprintf(stderr, fmt, ## args ); \
-    } \
-}
-#else
-#define log_err(fmt, args...){ \
-    if(log_is_open){ \
-      syslog(LOG_ERR, fmt, ## args ); \
-    }else { \
-      fprintf(stderr, fmt, ## args ); \
-    } \
-}
-#endif
-
-
-#ifdef DEBUG
-#define log_sys_err(fmt, args...){ \
-    if(log_is_open){ \
-      syslog(LOG_ERR, "[%s:%d] " fmt ": %m\n" , __FILE__ , __LINE__ , ## args ); \
-    }else { \
-      fprintf(stderr, "[%s:%d] ", __FILE__ , __LINE__); \
-      fprintf(stderr, fmt ": " , ## args ); \
-      perror(NULL); \
-    } \
-}
-#else
-#define log_sys_err(fmt, args...){ \
-    if(log_is_open){ \
-      syslog(LOG_ERR, fmt ": %m\n" , ## args ); \
-    }else { \
-      fprintf(stderr, fmt ": " , ## args ); \
-      perror(NULL); \
-    } \
-}
-#endif
-
-#define die(ext, fmt, args...) { \
-    if(log_is_open){ \
-      syslog(LOG_ERR, "In %s, at %d (%s) death by:\n" fmt , __FILE__ , \
-            __LINE__ , RELEASE_VERSION , ## args ); exit(ext); \
-    }else { \
-      fprintf(stderr, "In %s, at %d (%s) death by:\n" fmt , __FILE__ , \
-            __LINE__ , RELEASE_VERSION , ## args ); exit(ext); \
-    } \
-}
-
-
-#endif /* __LOG_H__ */
diff --git a/ccs/daemon/Makefile b/ccs/daemon/Makefile
index c4a862d..e41aec5 100644
--- a/ccs/daemon/Makefile
+++ b/ccs/daemon/Makefile
@@ -29,11 +29,12 @@ OBJS=	ccsd.o \
 	globals.o
 
 CFLAGS += -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
-CFLAGS += -I${cmanincdir} `xml2-config --cflags`
+CFLAGS += -I${cmanincdir} `xml2-config --cflags` -I${openaisincdir}
 CFLAGS += -I$(S) -I$(S)/../include -I$(S)/../common
 CFLAGS += -I${incdir}
 
 LDFLAGS += -L${cmanlibdir} -lcman -L${ccslibdir} -lccs
+LDFLAGS += -L${openaislibdir} -llogsys
 LDFLAGS += -L${libdir} `xml2-config --libs` -lpthread
 
 
diff --git a/ccs/daemon/ccsd.c b/ccs/daemon/ccsd.c
index d1e04c7..c3ba84f 100644
--- a/ccs/daemon/ccsd.c
+++ b/ccs/daemon/ccsd.c
@@ -1,7 +1,7 @@
 /******************************************************************************
 ******************************************************************************i
 **
-**  Copyright (C) 2004 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
 **
 **  This copyrighted material is made available to anyone wishing to use,
 **  modify, copy, or redistribute it subject to the terms and conditions
@@ -24,8 +24,8 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <libxml/parser.h>
+#include <openais/service/logsys.h>
 
-#include "log.h"
 #include "debug.h"
 #include "cnx_mgr.h"
 #include "cluster_mgr.h"
@@ -34,6 +34,7 @@
 
 #include "copyright.cf"
 
+static int debug = 0;
 extern volatile int quorate;
 int no_manager_opt=0;
 static int exit_now=0;
@@ -50,6 +51,13 @@ static int join_group(int sfd, int loopback, int port);
 static int setup_local_socket(int backlog);
 static inline void process_signals(void);
 
+LOGSYS_DECLARE_SYSTEM (NULL,
+	LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_DISPLAY_DEBUG | LOG_MODE_BUFFER_BEFORE_CONFIG,
+	NULL,
+	LOG_LOCAL4);
+
+LOGSYS_DECLARE_SUBSYS ("CCS", LOG_LEVEL_INFO);
+
 int main(int argc, char *argv[]){
   int i,error=0;
   int trueint = 1;
@@ -63,6 +71,11 @@ int main(int argc, char *argv[]){
 
   msg = parse_cli_args(argc, argv);
 
+  logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_DISPLAY_DEBUG | LOG_MODE_FLUSH_AFTER_CONFIG);
+
+  if(debug || getenv("CCS_DEBUGLOG"))
+    logsys_config_priority_set (LOG_LEVEL_DEBUG);
+
   if(check_cluster_conf()){
     /* check_cluster_conf will print out errors if there are any */
     exit(EXIT_FAILURE);
@@ -78,7 +91,7 @@ int main(int argc, char *argv[]){
 
   if (!no_manager_opt){
     if(start_cluster_monitor_thread()){
-      log_err("Unable to create thread.\n");
+      log_printf(LOG_ERR, "Unable to create thread.\n");
       exit(EXIT_FAILURE);
     }
   }
@@ -88,10 +101,10 @@ int main(int argc, char *argv[]){
   /** Setup the socket to communicate with the CCS library **/
   if(IPv6 && (sfds[0] = socket(PF_INET6, SOCK_STREAM, 0)) < 0){
     if(IPv6 == -1){
-      log_dbg("Unable to create IPv6 socket:: %s\n", strerror(errno));
+      log_printf(LOG_DEBUG, "Unable to create IPv6 socket:: %s\n", strerror(errno));
       IPv6=0;
     } else {
-      log_sys_err("Unable to create IPv6 socket");
+      log_printf(LOG_ERR, "Unable to create IPv6 socket");
       exit(EXIT_FAILURE);
     }
   } else {
@@ -100,15 +113,15 @@ int main(int argc, char *argv[]){
     */
   }
 
-  log_dbg("Using %s\n", IPv6?"IPv6":"IPv4");
+  log_printf(LOG_DEBUG, "Using %s\n", IPv6?"IPv6":"IPv4");
 
   if(!IPv6 && (sfds[0] = socket(PF_INET, SOCK_STREAM, 0)) < 0){
-    log_sys_err("Unable to create IPv4 socket");
+    log_printf(LOG_ERR, "Unable to create IPv4 socket");
     exit(EXIT_FAILURE);
   }
 
   if(setsockopt(sfds[0], SOL_SOCKET, SO_REUSEADDR, &trueint, sizeof(int))){
-    log_sys_err("Unable to set socket option");
+    log_printf(LOG_ERR, "Unable to set socket option");
     exit(EXIT_FAILURE);
   }
 
@@ -126,7 +139,7 @@ int main(int argc, char *argv[]){
   }
  
   if(bind(sfds[0], (struct sockaddr *)&addr, addr_size) < 0){
-    log_sys_err("Unable to bind socket");
+    log_printf(LOG_ERR, "Unable to bind socket");
     close(sfds[0]);
     exit(EXIT_FAILURE);
   }
@@ -137,12 +150,12 @@ int main(int argc, char *argv[]){
   /** Setup the socket to communicate with the CCS library **/
   sfds[1] = socket((IPv6)? PF_INET6: PF_INET, SOCK_DGRAM, 0);
   if(sfds[1] < 0){
-    log_sys_err("Socket creation failed");
+    log_printf(LOG_ERR, "Socket creation failed");
     exit(EXIT_FAILURE);
   } else {
     int trueint = 1;
     if(setsockopt(sfds[1], SOL_SOCKET, SO_REUSEADDR, &trueint, sizeof(int))){
-      log_sys_err("Unable to set socket option");
+      log_printf(LOG_ERR, "Unable to set socket option");
       exit(EXIT_FAILURE);
     }  
   }
@@ -158,14 +171,14 @@ int main(int argc, char *argv[]){
   }
  
   if(bind(sfds[1], (struct sockaddr *)&addr, addr_size) < 0){
-    log_sys_err("Unable to bind socket");
+    log_printf(LOG_ERR, "Unable to bind socket");
     close(sfds[1]);
     return -errno;
   }
 
   if(IPv6 || multicast_address){
     if(join_group(sfds[1], 1, backend_port)){
-      log_err("Unable to join multicast group.\n");
+      log_printf(LOG_ERR, "Unable to join multicast group.\n");
       exit(EXIT_FAILURE);
     }
   }
@@ -179,7 +192,7 @@ int main(int argc, char *argv[]){
   if (sfds[2] >= 0) 
     FD_SET(sfds[2], &rset);
 
-  log_dbg("Sending SIGTERM to parent\n");
+  log_printf(LOG_DEBUG, "Sending SIGTERM to parent\n");
   kill(getppid(), SIGTERM);
 
   while(1){
@@ -191,7 +204,7 @@ int main(int argc, char *argv[]){
 
     if((select(FD_SETSIZE, &tmp_set, NULL,NULL,NULL) < 0)){
       if(errno != EINTR){
-	log_sys_err("Select failed");
+	log_printf(LOG_ERR, "Select failed");
       }
       continue;
     }
@@ -202,44 +215,44 @@ int main(int argc, char *argv[]){
       }
       if(i == 0){
 	uint16_t port;
-	log_dbg("NORMAL CCS REQUEST.\n");
+	log_printf(LOG_DEBUG, "NORMAL CCS REQUEST.\n");
 	afd = accept(sfds[i], (struct sockaddr *)&addr, &len);
 	if(afd < 0){
-	  log_sys_err("Unable to accept connection");
+	  log_printf(LOG_ERR, "Unable to accept connection");
 	  continue;
 	}
 
 	port = (IPv6) ? addr6->sin6_port : addr4->sin_port;
 
-	log_dbg("Connection requested from port %u.\n", ntohs(port));
+	log_printf(LOG_DEBUG, "Connection requested from port %u.\n", ntohs(port));
 
 	if(ntohs(port) > 1024){
-	  log_err("Refusing connection from port > 1024:  port = %d", ntohs(port));
+	  log_printf(LOG_ERR, "Refusing connection from port > 1024:  port = %d", ntohs(port));
 	  close(afd);
 	  continue;
 	}
 	if((error = process_request(afd))){
-	  log_err("Error while processing request: %s\n", strerror(-error));
+	  log_printf(LOG_ERR, "Error while processing request: %s\n", strerror(-error));
 	}
 	close(afd);
       } else if (i == 2) {
-	log_dbg("NORMAL CCS REQUEST.\n");
+	log_printf(LOG_DEBUG, "NORMAL CCS REQUEST.\n");
 	afd = accept(sfds[i], NULL, NULL);
 	if(afd < 0){
-	  log_sys_err("Unable to accept connection");
+	  log_printf(LOG_ERR, "Unable to accept connection");
 	  continue;
 	}
 
-	log_dbg("Connection requested from local socket\n");
+	log_printf(LOG_DEBUG, "Connection requested from local socket\n");
 
 	if((error = process_request(afd))){
-	  log_err("Error while processing request: %s\n", strerror(-error));
+	  log_printf(LOG_ERR, "Error while processing request: %s\n", strerror(-error));
 	}
 	close(afd);
       } else {
-	log_dbg("BROADCAST REQUEST.\n");
+	log_printf(LOG_DEBUG, "BROADCAST REQUEST.\n");
 	if((error = process_broadcast(sfds[i]))){
-	  log_err("Error while processing broadcast: %s\n", strerror(-error));
+	  log_printf(LOG_ERR, "Error while processing broadcast: %s\n", strerror(-error));
 	}
       }
     }
@@ -254,7 +267,7 @@ int main(int argc, char *argv[]){
  *
  */
 static void print_usage(FILE *stream){
-  ENTER("print_usage");
+  CCSENTER("print_usage");
   fprintf(stream,
 	  "Usage:\n"
 	  "\n"
@@ -273,7 +286,7 @@ static void print_usage(FILE *stream){
 	  " -V            Print version information.\n"
 	  " -X            No cluster manager, just read local " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n"
 	  );
-  EXIT("print_usage");
+  CCSEXIT("print_usage");
 }
 
 
@@ -283,7 +296,7 @@ static int is_multicast_addr(char *addr_string){
   struct sockaddr_in *addr4 = (struct sockaddr_in *)&addr;
   struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&addr;
 
-  ENTER("is_multicast_addr");
+  CCSENTER("is_multicast_addr");
 
   if(inet_pton(AF_INET6, addr_string, &(addr6->sin6_addr)) > 0){
     if(IN6_IS_ADDR_MULTICAST(&addr6->sin6_addr)){
@@ -294,7 +307,7 @@ static int is_multicast_addr(char *addr_string){
       rtn = AF_INET;
     }
   }
-  EXIT("is_multicast_addr");
+  CCSEXIT("is_multicast_addr");
   return rtn;
 }
 
@@ -317,7 +330,7 @@ static char *parse_cli_args(int argc, char *argv[]){
   char buff[buff_size];
   int buff_index=0;
 
-  ENTER("parse_cli_args");
+  CCSENTER("parse_cli_args");
 
   config_file_location = strdup(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE);
   lockfile_location = strdup(DEFAULT_CCSD_LOCKFILE);
@@ -366,11 +379,9 @@ static char *parse_cli_args(int argc, char *argv[]){
 	      "Try '-h' for help.\n");
       error = -EINVAL;
       goto fail;
-    case 'd':  /* might be usable for upgrade */
-      fprintf(stderr, "The '-d' option is deprecated.\n"
-	      "Try '-h' for help.\n");
-      error = -EINVAL;
-      goto fail;
+    case 'd':
+      debug = 1;
+      break;
     case 'f':  /* might be usable for upgrade */
       free(config_file_location);
       config_file_location = optarg;
@@ -491,7 +502,7 @@ static char *parse_cli_args(int argc, char *argv[]){
   }
 
  fail:
-  EXIT("parse_cli_args");
+  CCSEXIT("parse_cli_args");
 
   if(error){
     exit(EXIT_FAILURE);
@@ -516,10 +527,12 @@ static int check_cluster_conf(void){
   struct stat stat_buf;
   xmlDocPtr doc = NULL;
 
+  CCSENTER("check_cluster_conf");
+
   if(!stat(config_file_location, &stat_buf)){
     doc = xmlParseFile(config_file_location);
     if(!doc){
-      log_err("\nUnable to parse %s.\n"
+      log_printf(LOG_ERR, "\nUnable to parse %s.\n"
 	      "You should either:\n"
 	      " 1. Correct the XML mistakes, or\n"
 	      " 2. (Re)move the file and attempt to grab a "
@@ -530,7 +543,7 @@ static int check_cluster_conf(void){
   } else {
     /* no cluster.conf file.  This is fine, just need to get it from the network */
     if(no_manager_opt){
-      log_err("\nNo local config file found: %s\n", config_file_location);
+      log_printf(LOG_ERR, "\nNo local config file found: %s\n", config_file_location);
       return -1;
     }
   }
@@ -551,17 +564,17 @@ static int create_lockfile(char *lockfile){
   struct flock lock;
   char buffer[50];
 
-  ENTER("create_lockfile");
+  CCSENTER("create_lockfile");
    
   if(!strncmp(lockfile, "/var/run/cluster/", 17)){
     if(stat("/var/run/cluster", &stat_buf)){
       if(mkdir("/var/run/cluster", S_IRWXU)){
-        log_sys_err("Cannot create lockfile directory");
+        log_printf(LOG_ERR, "Cannot create lockfile directory");
         error = -errno;
 	goto fail;
       }
     } else if(!S_ISDIR(stat_buf.st_mode)){
-      log_err("/var/run/cluster is not a directory.\n"
+      log_printf(LOG_ERR, "/var/run/cluster is not a directory.\n"
               "Cannot create lockfile.\n");
       error = -ENOTDIR;
       goto fail;
@@ -570,7 +583,7 @@ static int create_lockfile(char *lockfile){
  
   if((fd = open(lockfile, O_CREAT | O_WRONLY,
                 (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) < 0){
-    log_sys_err("Cannot create lockfile");
+    log_printf(LOG_ERR, "Cannot create lockfile");
     error = -errno;
     goto fail;
   }
@@ -582,7 +595,7 @@ static int create_lockfile(char *lockfile){
  
   if (fcntl(fd, F_SETLK, &lock) < 0) {
     close(fd);
-    log_err("The ccsd process is already running.\n");
+    log_printf(LOG_ERR, "The ccsd process is already running.\n");
     error = -errno;
     goto fail;
   }
@@ -603,7 +616,7 @@ static int create_lockfile(char *lockfile){
   }
 
  fail: 
-  EXIT("create_lockfile");
+  CCSEXIT("create_lockfile");
   
   /* leave fd open - rely on exit to close it */
   if(error){
@@ -620,9 +633,9 @@ static int create_lockfile(char *lockfile){
  *
  */
 static void parent_exit_handler(int sig){
-  ENTER("parent_exit_handler");
+  CCSENTER("parent_exit_handler");
   exit_now=1;
-  EXIT("parent_exit_handler");
+  CCSEXIT("parent_exit_handler");
 }
 
 
@@ -640,32 +653,32 @@ static void sig_handler(int sig){
 static void process_signal(int sig){
   int err;
 
-  ENTER("sig_handler");
+  CCSENTER("sig_handler");
 
   switch(sig) {
   case SIGINT:
-    log_msg("Stopping ccsd, SIGINT received.\n");
+    log_printf(LOG_INFO, "Stopping ccsd, SIGINT received.\n");
     err = EXIT_SUCCESS;
     break;
   case SIGQUIT:
-    log_msg("Stopping ccsd, SIGQUIT received.\n");
+    log_printf(LOG_INFO, "Stopping ccsd, SIGQUIT received.\n");
     err = EXIT_SUCCESS;
     break;
   case SIGTERM:
-    log_msg("Stopping ccsd, SIGTERM received.\n");
+    log_printf(LOG_INFO, "Stopping ccsd, SIGTERM received.\n");
     err = EXIT_SUCCESS;
     break;
   case SIGHUP:
-    log_msg("SIGHUP received.\n");
-    log_msg("Use ccs_tool for updates.\n");
+    log_printf(LOG_INFO, "SIGHUP received.\n");
+    log_printf(LOG_INFO, "Use ccs_tool for updates.\n");
     return;
     break;
   default:
-    log_err("Stopping ccsd, unknown signal %d received.\n", sig);
+    log_printf(LOG_ERR, "Stopping ccsd, unknown signal %d received.\n", sig);
     err = EXIT_FAILURE;
   }
 
-  EXIT("sig_handler");
+  CCSEXIT("sig_handler");
   exit(err);
 }
 
@@ -702,22 +715,22 @@ static void daemonize(void){
   int error=0;
   int pid;
 
-  ENTER("daemonize");
+  CCSENTER("daemonize");
 
   if(flags & FLAG_NODAEMON){
-    log_dbg("Entering non-daemon mode.\n");
+    log_printf(LOG_DEBUG, "Entering non-daemon mode.\n");
     if((error = create_lockfile(lockfile_location))){
       goto fail;
     }
   } else {
-    log_dbg("Entering daemon mode.\n");
+    log_printf(LOG_DEBUG, "Entering daemon mode.\n");
 
     signal(SIGTERM, &parent_exit_handler);
 
     pid = fork();
 
     if(pid < 0){
-      fprintf(stderr, "Unable to fork().\n");
+      log_printf(LOG_ERR, "Unable to fork().\n");
       error = pid;
       goto fail;
     }
@@ -725,16 +738,17 @@ static void daemonize(void){
     if(pid){
       int status;
       while(!waitpid(pid, &status, WNOHANG) && !exit_now);
-      if(exit_now)
+      if(exit_now) {
 	exit(EXIT_SUCCESS);
+      }
 
       switch(WEXITSTATUS(status)){
       case EXIT_CLUSTER_FAIL:
-	fprintf(stderr, "Failed to connect to cluster manager.\n");
+	log_printf(LOG_ERR, "Failed to connect to cluster manager.\n");
 	break;
       case EXIT_LOCKFILE:
-	fprintf(stderr, "Failed to create lockfile.\n");
-	fprintf(stderr, "Hint: ccsd is already running.\n");
+	log_printf(LOG_ERR, "Failed to create lockfile.\n");
+	log_printf(LOG_ERR, "Hint: ccsd is already running.\n");
 	break;
       }
       exit(EXIT_FAILURE);
@@ -749,14 +763,13 @@ static void daemonize(void){
     open("/dev/null", O_WRONLY); /* reopen stdout */
     open("/dev/null", O_WRONLY); /* reopen stderr */
 
-    log_open("ccsd", LOG_PID, LOG_DAEMON);
-
     if((error = create_lockfile(lockfile_location))){
       exit(EXIT_LOCKFILE);
     }
 
     /* Make the parent stop waiting */
-    /* kill(getppid(), SIGTERM); */
+    //log_printf(LOG_DEBUG, "Die early\n");
+    //kill(getppid(), SIGTERM);
   }
 
   signal(SIGINT, &sig_handler);
@@ -768,7 +781,7 @@ static void daemonize(void){
   signal_received = 0;
 
  fail:
-  EXIT("daemonize");
+  CCSEXIT("daemonize");
 
   if(error){
     exit(EXIT_FAILURE);
@@ -781,13 +794,15 @@ static void daemonize(void){
  *
  */
 static void print_start_msg(char *msg){
+  CCSENTER("print_start_msg");
   /* We want the start message to print every time */
-  log_msg("Starting ccsd %s:\n", RELEASE_VERSION);
-  log_msg(" Built: "__DATE__" "__TIME__"\n");
-  log_msg(" %s\n", REDHAT_COPYRIGHT);
+  log_printf(LOG_INFO, "Starting ccsd %s:\n", RELEASE_VERSION);
+  log_printf(LOG_INFO, " Built: "__DATE__" "__TIME__"\n");
+  log_printf(LOG_INFO, " %s\n", REDHAT_COPYRIGHT);
   if(msg){
-    log_msg("%s\n", msg);
+    log_printf(LOG_INFO, "%s\n", msg);
   }
+  CCSEXIT("print_start_msg");
 }
 
 
@@ -798,7 +813,7 @@ static int join_group(int sfd, int loopback, int port){
   struct sockaddr_in *addr4 = (struct sockaddr_in *)&addr;
   struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&addr;
  
-  ENTER("join_group");
+  CCSENTER("join_group");
   
   if(IPv6){
     if(!multicast_address || !strcmp("default", multicast_address)){
@@ -828,13 +843,13 @@ static int join_group(int sfd, int loopback, int port){
 
     if(setsockopt(sfd, IPPROTO_IP, IP_MULTICAST_LOOP,
 		  &loopback, sizeof(loopback)) < 0){
-      log_err("Unable to %s loopback.\n", loopback?"SET":"UNSET");
+      log_printf(LOG_ERR, "Unable to %s loopback.\n", loopback?"SET":"UNSET");
       error = -errno;
       goto fail;
     }
     if(setsockopt(sfd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
 		  (const void *)&mreq, sizeof(mreq)) < 0){
-      log_err("Unable to add to membership.\n");
+      log_printf(LOG_ERR, "Unable to add to membership.\n");
       error = -errno;
       goto fail;
     }
@@ -847,22 +862,22 @@ static int join_group(int sfd, int loopback, int port){
 
     if(setsockopt(sfd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
 		  &loopback, sizeof(loopback)) < 0){
-      log_err("Unable to %s loopback.\n", loopback?"SET":"UNSET");
+      log_printf(LOG_ERR, "Unable to %s loopback.\n", loopback?"SET":"UNSET");
       error = -errno;
       goto fail;
     }
     if(setsockopt(sfd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP,
 		  (const void *)&mreq, sizeof(mreq)) < 0){
-      log_err("Unable to add to membership: %s\n", strerror(errno));
+      log_printf(LOG_ERR, "Unable to add to membership: %s\n", strerror(errno));
       error = -errno;
       goto fail;
     }
   } else {
-    log_err("Unknown address family.\n");
+    log_printf(LOG_ERR, "Unknown address family.\n");
     error = -EINVAL;
   }
  fail:
-  EXIT("join_group");
+  CCSEXIT("join_group");
   return 0;
 }
 
@@ -872,7 +887,7 @@ int setup_local_socket(int backlog)
   struct sockaddr_un su;
   mode_t om;
 
-  ENTER("setup_local_socket");
+  CCSENTER("setup_local_socket");
   if (use_local == 0)
     goto fail;
 
@@ -895,12 +910,12 @@ int setup_local_socket(int backlog)
   if (listen(sock, backlog) < 0)
     goto fail;
 
-  log_dbg("Set up local socket on %s\n", su.sun_path);
-  EXIT("setup_local_socket");
+  log_printf(LOG_DEBUG, "Set up local socket on %s\n", su.sun_path);
+  CCSEXIT("setup_local_socket");
   return sock;
 fail:
   if (sock >= 0)
     close(sock);
-  EXIT("setup_local_socket");
+  CCSEXIT("setup_local_socket");
   return -1;
 }
diff --git a/ccs/daemon/cluster_mgr.c b/ccs/daemon/cluster_mgr.c
index 3ce2957..bbfbee0 100644
--- a/ccs/daemon/cluster_mgr.c
+++ b/ccs/daemon/cluster_mgr.c
@@ -22,9 +22,9 @@
 #include <sys/ioctl.h>
 #include <errno.h>
 #include <libxml/parser.h>
+#include <openais/service/logsys.h>
 
 #include "comm_headers.h"
-#include "log.h"
 #include "debug.h"
 #include "misc.h"
 #include "globals.h"
@@ -48,6 +48,8 @@ static int select_retry(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *xfds,
 
 static ssize_t read_retry(int fd, void *buf, int count, struct timeval *timeout);
 
+LOGSYS_DECLARE_SUBSYS ("CCS", LOG_INFO);
+
 static int check_update_doc(xmlDocPtr tmp_doc)
 {
   int error = 0;
@@ -55,32 +57,32 @@ static int check_update_doc(xmlDocPtr tmp_doc)
   char *str1 = NULL;
   char *str2 = NULL;
 
-  ENTER("check_update_doc");
+  CCSENTER("check_update_doc");
 
   if (!(str1 = get_cluster_name(tmp_doc))) {
-    log_err("Unable to get cluster name from new config file.\n");
+    log_printf(LOG_ERR, "Unable to get cluster name from new config file.\n");
     error = -EINVAL;
     goto fail;
   }
 
   if (master_doc && master_doc->od_doc &&
       !(str2 = get_cluster_name(master_doc->od_doc))) {
-    log_dbg("Unable to get cluster name from current master doc.\n");
+    log_printf(LOG_DEBUG, "Unable to get cluster name from current master doc.\n");
   }
 
   if (str2 && strcmp(str1, str2)) {
-    log_err("Cluster names for current and update configs do not match.\n");
-    log_err("  Current cluster name:: <%s>\n", str2);
-    log_err("  Proposed update name:: <%s>\n", str1);
+    log_printf(LOG_ERR, "Cluster names for current and update configs do not match.\n");
+    log_printf(LOG_ERR, "  Current cluster name:: <%s>\n", str2);
+    log_printf(LOG_ERR, "  Proposed update name:: <%s>\n", str1);
     error = -EINVAL;
     goto fail;
   }
 
   if (master_doc && master_doc->od_doc &&
       (get_doc_version(tmp_doc) <= get_doc_version(master_doc->od_doc))) {
-    log_err("Proposed updated config file does not have greater version number.\n");
-    log_err("  Current config_version :: %d\n", get_doc_version(master_doc->od_doc));
-    log_err("  Proposed config_version:: %d\n", get_doc_version(tmp_doc));
+    log_printf(LOG_ERR, "Proposed updated config file does not have greater version number.\n");
+    log_printf(LOG_ERR, "  Current config_version :: %d\n", get_doc_version(master_doc->od_doc));
+    log_printf(LOG_ERR, "  Proposed config_version:: %d\n", get_doc_version(tmp_doc));
     error = -EINVAL;
   }
 
@@ -94,7 +96,7 @@ fail:
     free(str2);
   }
 
-  EXIT("check_update_doc");
+  CCSEXIT("check_update_doc");
   return error;
 }
 
@@ -116,39 +118,39 @@ static int handle_cluster_message(int fd)
   struct sockaddr client_addr;
   static uint64_t master_node = 0;
 
-  ENTER("handle_cluster_message");
+  CCSENTER("handle_cluster_message");
 
-  log_dbg("Cluster message on socket: %d\n", fd);
+  log_printf(LOG_DEBUG, "Cluster message on socket: %d\n", fd);
 
   client_len = sizeof(client_addr);
 
   if ((socket = accept(fd, &client_addr, &client_len)) < 0) {
-    log_sys_err("Failed to accept connection.\n");
+    log_printf(LOG_ERR, "Failed to accept connection.\n");
     goto fail;
   }
 
   if ((nodeid = member_addr_to_id(members, &client_addr)) < 0) {
-    log_err("Unable to determine node ID.\n");
+    log_printf(LOG_ERR, "Unable to determine node ID.\n");
     goto fail;
   }
 
-  log_dbg("Accept socket: %d\n", socket);
+  log_printf(LOG_DEBUG, "Accept socket: %d\n", socket);
 
   error = recv(socket, &ch, sizeof(comm_header_t), MSG_PEEK);
 
   if (error < 0) {
-    log_sys_err("Failed to receive message from %s\n",
+    log_printf(LOG_ERR, "Failed to receive message from %s\n",
 		member_id_to_name(members, nodeid));
     goto fail;
   }
 
-  log_dbg("Message (%d bytes) received from %s\n",
+  log_printf(LOG_DEBUG, "Message (%d bytes) received from %s\n",
 	  error, member_id_to_name(members, nodeid));
 
   swab_header(&ch);
 
   if (ch.comm_type != COMM_UPDATE) {
-    log_err("Unexpected communication type (%d)... ignoring.\n",
+    log_printf(LOG_ERR, "Unexpected communication type (%d)... ignoring.\n",
 	    ch.comm_type);
     error = -EINVAL;
     goto fail;
@@ -157,12 +159,12 @@ static int handle_cluster_message(int fd)
   if (ch.comm_flags == COMM_UPDATE_NOTICE) {
     buffer = malloc(ch.comm_payload_size + sizeof(comm_header_t));
     if (!buffer) {
-      log_err("Unable to allocate space to perform update.\n");
+      log_printf(LOG_ERR, "Unable to allocate space to perform update.\n");
       error = -ENOMEM;
       goto fail;
     }
 
-    log_dbg("Updated config size:: %d\n", ch.comm_payload_size);
+    log_printf(LOG_DEBUG, "Updated config size:: %d\n", ch.comm_payload_size);
 
     tv.tv_sec = 5;
     tv.tv_usec = 0;
@@ -170,19 +172,19 @@ static int handle_cluster_message(int fd)
     error = read_retry(socket, buffer, ch.comm_payload_size + sizeof(comm_header_t), &tv);
 
     if (error < 0) {
-      log_sys_err("Unable to retrieve updated config");
+      log_printf(LOG_ERR, "Unable to retrieve updated config");
       goto fail;
     }
 
     pthread_mutex_lock(&update_lock);
     unlock = 1;
 
-    log_dbg("Got lock 0\n");
+    log_printf(LOG_DEBUG, "Got lock 0\n");
     
     tmp_doc = xmlParseMemory(buffer+sizeof(comm_header_t), ch.comm_payload_size);
 
     if (!tmp_doc) {
-      log_err("Unable to parse updated config file.\n");
+      log_printf(LOG_ERR, "Unable to parse updated config file.\n");
       /* ATTENTION -- need better error code */
       error = -EIO;
       goto fail;
@@ -199,28 +201,28 @@ static int handle_cluster_message(int fd)
     umask(old_mode);
 
     if (!fp) {
-      log_sys_err("Unable to open " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update");
+      log_printf(LOG_ERR, "Unable to open " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update");
       error = -errno;
       goto fail;
     }
 
     if (xmlDocDump(fp, tmp_doc) < 0) {
-      log_sys_err("Unable to write " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update");
+      log_printf(LOG_ERR, "Unable to write " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update");
       goto fail;
     }
 
-    log_dbg("Upload of new config file from %s complete.\n",
+    log_printf(LOG_DEBUG, "Upload of new config file from %s complete.\n",
 	    member_id_to_name(members, nodeid));
 
     ch.comm_payload_size = 0;
     ch.comm_flags = COMM_UPDATE_NOTICE_ACK;
 
-    log_dbg("Sending COMM_UPDATE_NOTICE_ACK.\n");
+    log_printf(LOG_DEBUG, "Sending COMM_UPDATE_NOTICE_ACK.\n");
 
     swab_header(&ch);
 
     if ((error = write(socket, &ch, sizeof(comm_header_t))) < 0) {
-      log_sys_err("Unable to send COMM_UPDATE_NOTICE_ACK.\n");
+      log_printf(LOG_ERR, "Unable to send COMM_UPDATE_NOTICE_ACK.\n");
       goto fail;
     }
 
@@ -236,8 +238,8 @@ static int handle_cluster_message(int fd)
     error = read_retry(socket, &ch, sizeof(comm_header_t), &tv);
 
     if (master_node != nodeid) {
-      log_err("COMM_UPDATE_COMMIT received from node other than initiator.\n");
-      log_err("Hint: There may be multiple updates happening at once.\n");
+      log_printf(LOG_ERR, "COMM_UPDATE_COMMIT received from node other than initiator.\n");
+      log_printf(LOG_ERR, "Hint: There may be multiple updates happening at once.\n");
       error = -EPERM;
       goto fail;
     }
@@ -246,12 +248,12 @@ static int handle_cluster_message(int fd)
 
     unlock = 1;
 
-    log_dbg("Got lock 1\n");
+    log_printf(LOG_DEBUG, "Got lock 1\n");
 
     tmp_doc = xmlParseFile(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update");
 
     if (!tmp_doc) {
-      log_err("Unable to parse updated config file.\n");
+      log_printf(LOG_ERR, "Unable to parse updated config file.\n");
       /* ATTENTION -- need better error code */
       error = -EIO;
       goto fail;
@@ -268,13 +270,13 @@ static int handle_cluster_message(int fd)
     umask(old_mode);
 
     if (!fp) {
-      log_sys_err("Unable to open " DEFAULT_CONFIG_DIR "/." DEFAULT_CONFIG_FILE);
+      log_printf(LOG_ERR, "Unable to open " DEFAULT_CONFIG_DIR "/." DEFAULT_CONFIG_FILE);
       error = -errno;
       goto fail;
     }
 
     if (xmlDocDump(fp, tmp_doc) < 0) {
-      log_sys_err("Unable to write " DEFAULT_CONFIG_DIR "/." DEFAULT_CONFIG_FILE);
+      log_printf(LOG_ERR, "Unable to write " DEFAULT_CONFIG_DIR "/." DEFAULT_CONFIG_FILE);
       goto fail;
     }
 
@@ -283,12 +285,12 @@ static int handle_cluster_message(int fd)
     update_required = 1;
     ch.comm_flags = COMM_UPDATE_COMMIT_ACK;
 
-    log_dbg("Sending COMM_UPDATE_COMMIT_ACK.\n");
+    log_printf(LOG_DEBUG, "Sending COMM_UPDATE_COMMIT_ACK.\n");
 
     swab_header(&ch);
 
     if ((error = write(socket, &ch, sizeof(comm_header_t))) < 0) {
-      log_sys_err("Unable to send COMM_UPDATE_NOTICE_ACK.\n");
+      log_printf(LOG_ERR, "Unable to send COMM_UPDATE_NOTICE_ACK.\n");
       goto fail;
     }
 
@@ -317,7 +319,7 @@ fail:
     pthread_mutex_unlock(&update_lock);
   }
 
-  EXIT("handle_cluster_message");
+  CCSEXIT("handle_cluster_message");
   return error;
 }
 
@@ -343,7 +345,7 @@ static void cman_callback(cman_handle_t handle, void *private, int reason, int a
 
 static int handle_cluster_event(cman_handle_t handle)
 {
-  ENTER("handle_cluster_event");
+  CCSENTER("handle_cluster_event");
 
   int rv = 1;
   while (rv > 0) {
@@ -353,7 +355,7 @@ static int handle_cluster_event(cman_handle_t handle)
     return -1;
   }
 
-  EXIT("handle_cluster_event");
+  CCSEXIT("handle_cluster_event");
   return 0;
 }
 
@@ -376,14 +378,14 @@ static void cluster_communicator(void)
   struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&addr;
   int addr_size=0;
 
-  ENTER("cluster_communicator");
+  CCSENTER("cluster_communicator");
 
   memset(&addr, 0, sizeof(struct sockaddr_storage));
 
   if (IPv6) {
     if ((ccsd_fd = socket(PF_INET6, SOCK_STREAM, 0)) < 0) {
       if(IPv6 == -1) {
-	log_dbg("Unable to create IPv6 socket:: %s\n", strerror(errno));
+	log_printf(LOG_DEBUG, "Unable to create IPv6 socket:: %s\n", strerror(errno));
 	IPv6=0;
      }
     }
@@ -391,13 +393,13 @@ static void cluster_communicator(void)
 
   if (!IPv6) {
     if ((ccsd_fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
-      log_err("Unable to create IPv4 socket.\n");
+      log_printf(LOG_ERR, "Unable to create IPv4 socket.\n");
       exit(EXIT_FAILURE);
     }
   }
 
   if (setsockopt(ccsd_fd, SOL_SOCKET, SO_REUSEADDR, (void *)&opt, sizeof(opt)) < 0) {
-    log_sys_err("Unable to set socket option");
+    log_printf(LOG_ERR, "Unable to set socket option");
     exit(EXIT_FAILURE);
   }
 
@@ -418,13 +420,13 @@ static void cluster_communicator(void)
   fcntl(ccsd_fd, F_SETFD, flags);
 
   if (bind(ccsd_fd, (struct sockaddr *)&addr, addr_size) < 0) {
-    log_err("Unable to bind to socket.\n");
+    log_printf(LOG_ERR, "Unable to bind to socket.\n");
     close(ccsd_fd);
     exit(EXIT_FAILURE);
   }
 
   if (listen(ccsd_fd, 15) < 0) {
-    log_err("Unable to listen to socket.\n");
+    log_printf(LOG_ERR, "Unable to listen to socket.\n");
     close(ccsd_fd);
     exit(EXIT_FAILURE);
   }
@@ -441,7 +443,7 @@ restart:
 
       if (!(warn_user % 30))
       {
-	log_err("Unable to connect to cluster infrastructure after %d seconds.\n",
+	log_printf(LOG_ERR, "Unable to connect to cluster infrastructure after %d seconds.\n",
 		warn_user);
       }
 
@@ -458,7 +460,7 @@ restart:
 
   quorate = cman_is_quorate(handle);
 
-  log_msg("Initial status:: %s\n", (quorate)? "Quorate" : "Inquorate");
+  log_printf(LOG_INFO, "Initial status:: %s\n", (quorate)? "Quorate" : "Inquorate");
 
   members = get_member_list(handle);
 
@@ -472,18 +474,18 @@ restart:
 
     max_fd = (ccsd_fd > cman_fd) ? ccsd_fd : cman_fd;
 
-    log_dbg("Waiting for cluster event.\n");
+    log_printf(LOG_DEBUG, "Waiting for cluster event.\n");
     
     if ((n = select((max_fd + 1), &rset, NULL, NULL, NULL)) < 0) {
-      log_sys_err("Select failed");
+      log_printf(LOG_ERR, "Select failed");
       continue;
     }
 
-    log_dbg("There are %d cluster messages waiting.\n", n);
+    log_printf(LOG_DEBUG, "There are %d cluster messages waiting.\n", n);
 
     while (n)
     {
-      log_dbg("There are %d messages remaining.\n", n);
+      log_printf(LOG_DEBUG, "There are %d messages remaining.\n", n);
 
       n--;
 
@@ -501,7 +503,7 @@ restart:
     }
   }
 
-  EXIT("cluster_communicator");
+  CCSEXIT("cluster_communicator");
 }
 
 
@@ -509,14 +511,14 @@ int start_cluster_monitor_thread(void) {
   int error = 0;
   pthread_t thread;
 
-  ENTER("start_cluster_monitor_thread");
+  CCSENTER("start_cluster_monitor_thread");
 
   pthread_mutex_init(&update_lock, NULL);
 
   error = pthread_create(&thread, NULL, (void *)cluster_communicator, NULL);
 
   if (error) {
-    log_err("Failed to create thread: %s\n", strerror(-error));
+    log_printf(LOG_ERR, "Failed to create thread: %s\n", strerror(-error));
     goto fail;
   }
 
@@ -524,7 +526,7 @@ int start_cluster_monitor_thread(void) {
 
 fail:
 
-  EXIT("start_cluster_monitor_thread");
+  CCSEXIT("start_cluster_monitor_thread");
   return error;
 }
 
diff --git a/ccs/daemon/cnx_mgr.c b/ccs/daemon/cnx_mgr.c
index a2011af..8cdc579 100644
--- a/ccs/daemon/cnx_mgr.c
+++ b/ccs/daemon/cnx_mgr.c
@@ -28,8 +28,8 @@
 #include <libxml/tree.h>
 #include <libxml/xpath.h>
 #include <libxml/xpathInternals.h>
+#include <openais/service/logsys.h>
 
-#include "log.h"
 #include "comm_headers.h"
 #include "debug.h"
 #include "misc.h"
@@ -65,6 +65,8 @@ typedef struct open_connection_s {
   time_t oc_expire;
 } open_connection_t;
 
+LOGSYS_DECLARE_SUBSYS ("CCS", LOG_INFO);
+
 /* ATTENTION: need to lock on this if we start forking the daemon **
 **  Also would need to create a shared memory area for open cnx's */
 static open_connection_t **ocs = NULL;
@@ -76,23 +78,23 @@ static int _update_config(char *location){
   open_doc_t *tmp_odoc = NULL;
   xmlDocPtr tmp_doc = NULL;
 
-  ENTER("_update_config");
+  CCSENTER("_update_config");
 
   tmp_doc = xmlParseFile(location);
   if(!tmp_doc){
-    log_err("Unable to parse %s\n", location);
+    log_printf(LOG_ERR, "Unable to parse %s\n", location);
     error = -EINVAL;
     goto fail;
   } else if((v2 = get_doc_version(tmp_doc)) < 0){
-    log_err("Unable to get config_version from %s.\n", location);
+    log_printf(LOG_ERR, "Unable to get config_version from %s.\n", location);
     error = v2;
     goto fail;
   } else if(master_doc && master_doc->od_doc){
     v1 = get_doc_version(master_doc->od_doc);
     if(v1 >= v2){
-      log_err("%s on-disk version is <= to in-memory version.\n", location);
-      log_err(" On-disk version   : %d\n", v2);
-      log_err(" In-memory version : %d\n", v1);
+      log_printf(LOG_ERR, "%s on-disk version is <= to in-memory version.\n", location);
+      log_printf(LOG_ERR, " On-disk version   : %d\n", v2);
+      log_printf(LOG_ERR, " In-memory version : %d\n", v1);
       error = -EPERM;
       goto fail;
     }
@@ -108,10 +110,10 @@ static int _update_config(char *location){
 
   tmp_odoc->od_doc = tmp_doc;
 
-  log_dbg("There are %d references open on version %d of the config file.\n",
+  log_printf(LOG_DEBUG, "There are %d references open on version %d of the config file.\n",
 	  (master_doc)?master_doc->od_refs:0, v1);
   if(master_doc && !master_doc->od_refs){
-    log_dbg("Freeing version %d\n", v1);
+    log_printf(LOG_DEBUG, "Freeing version %d\n", v1);
     xmlFreeDoc(master_doc->od_doc);
     free(master_doc);
     master_doc = tmp_odoc;
@@ -119,7 +121,7 @@ static int _update_config(char *location){
     master_doc = tmp_odoc;
   }
 
-  log_msg("Update of "DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE " complete (version %d -> %d).\n", v1, v2);
+  log_printf(LOG_INFO, "Update of "DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE " complete (version %d -> %d).\n", v1, v2);
  fail:
   if(tmp_odoc != master_doc){
     free(tmp_odoc);
@@ -129,14 +131,14 @@ static int _update_config(char *location){
   }
 
 
-  EXIT("_update_config");
+  CCSEXIT("_update_config");
   return error;
 }
 
 
 static int update_config(void){
   int error = 0;
-  ENTER("update_config");
+  CCSENTER("update_config");
 
   /* If update_required is set, it means that there is still a pending **
   ** update.  We need to pull this one in before doing anything else.  */
@@ -144,13 +146,13 @@ static int update_config(void){
     error = _update_config(DEFAULT_CONFIG_DIR "/." DEFAULT_CONFIG_FILE);
     update_required = 0;
     if(error){
-      log_err("Previous update could not be completed.\n");
+      log_printf(LOG_ERR, "Previous update could not be completed.\n");
       goto fail;
     }
   }
 
  fail:
-  EXIT("update_config");
+  CCSEXIT("update_config");
   return error;
 }
 
@@ -179,17 +181,17 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
   struct timeval tv;
   xmlDocPtr tmp_doc = NULL;
 
-  ENTER("broadcast_for_doc");
+  CCSENTER("broadcast_for_doc");
 
  try_again:
   if(!master_doc){
-    log_err("No master_doc!!!\n");
+    log_printf(LOG_ERR, "No master_doc!!!\n");
     exit(EXIT_FAILURE);
   }
 
   if(quorate && !cluster_name){
-    log_err("Node is part of quorate cluster, but the cluster name is unknown.\n");
-    log_err(" Unable to validate remote config files.  Refusing connection.\n");
+    log_printf(LOG_ERR, "Node is part of quorate cluster, but the cluster name is unknown.\n");
+    log_printf(LOG_ERR, " Unable to validate remote config files.  Refusing connection.\n");
     error = -ECONNREFUSED;
     goto fail;
   }
@@ -202,13 +204,13 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
   memset(ch, 0, sizeof(comm_header_t));
 
   if(IPv6 && (sfd = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP)) <0){
-    log_sys_err("Unable to create IPv6 socket");
+    log_printf(LOG_ERR, "Unable to create IPv6 socket");
     error = -errno;
     goto fail;
   }
 
   if(!IPv6 && ((sfd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)){
-    log_sys_err("Unable to create socket for broadcast");
+    log_printf(LOG_ERR, "Unable to create socket for broadcast");
     error = -errno;
     goto fail;
   }
@@ -223,16 +225,16 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
     addr6->sin6_port = htons(backend_port);
 
     if(!multicast_address || !strcmp(multicast_address, "default")){
-      log_dbg("Trying IPv6 multicast (default).\n");
+      log_printf(LOG_DEBUG, "Trying IPv6 multicast (default).\n");
       if(inet_pton(AF_INET6, "ff02::3:1", &(addr6->sin6_addr)) <= 0){
-	log_sys_err("Unable to convert multicast address");
+	log_printf(LOG_ERR, "Unable to convert multicast address");
 	error = -errno;
 	goto fail;
       }
     } else {
-      log_dbg("Trying IPv6 multicast (%s).\n", multicast_address);
+      log_printf(LOG_DEBUG, "Trying IPv6 multicast (%s).\n", multicast_address);
       if(inet_pton(AF_INET6, multicast_address, &(addr6->sin6_addr)) <= 0){
-	log_sys_err("Unable to convert multicast address");
+	log_printf(LOG_ERR, "Unable to convert multicast address");
 	error = -errno;
 	goto fail;
       }
@@ -244,7 +246,7 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
 
     if(setsockopt(sfd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
                   &opt, sizeof(opt)) < 0){
-      log_err("Unable to %s loopback.\n", opt?"SET":"UNSET");
+      log_printf(LOG_ERR, "Unable to %s loopback.\n", opt?"SET":"UNSET");
       error = -errno;
       goto fail;
     }
@@ -252,28 +254,28 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
     addr4->sin_family = AF_INET;
     addr4->sin_port = htons(backend_port);
     if(!multicast_address){
-      log_dbg("Trying IPv4 broadcast.\n");
+      log_printf(LOG_DEBUG, "Trying IPv4 broadcast.\n");
 
       addr4->sin_addr.s_addr = INADDR_BROADCAST;
       if((error = setsockopt(sfd, SOL_SOCKET, SO_BROADCAST, &trueint, sizeof(int)))){
-	log_sys_err("Unable to set socket options");
+	log_printf(LOG_ERR, "Unable to set socket options");
 	error = -errno;
 	goto fail;
       } else {
-	log_dbg("  Broadcast enabled.\n");
+	log_printf(LOG_DEBUG, "  Broadcast enabled.\n");
       }
     } else {
       if(!strcmp(multicast_address, "default")){
-	log_dbg("Trying IPv4 multicast (default).\n");
+	log_printf(LOG_DEBUG, "Trying IPv4 multicast (default).\n");
 	if(inet_pton(AF_INET, "224.0.2.5", &(addr4->sin_addr)) <= 0){
-	  log_sys_err("Unable to convert multicast address");
+	  log_printf(LOG_ERR, "Unable to convert multicast address");
 	  error = -errno;
 	  goto fail;
 	}
       } else {
-	log_dbg("Trying IPv4 multicast (%s).\n", multicast_address);
+	log_printf(LOG_DEBUG, "Trying IPv4 multicast (%s).\n", multicast_address);
 	if(inet_pton(AF_INET, multicast_address, &(addr4->sin_addr)) <= 0){
-	  log_sys_err("Unable to convert multicast address");
+	  log_printf(LOG_ERR, "Unable to convert multicast address");
 	  error = -errno;
 	  goto fail;
 	}
@@ -281,7 +283,7 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
       opt = 0;
       setsockopt(sfd, IPPROTO_IP, IP_MULTICAST_LOOP, &opt, sizeof(opt));
       if(setsockopt(sfd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0){
-	log_sys_err("Unable to set multicast threshold.\n");
+	log_printf(LOG_ERR, "Unable to set multicast threshold.\n");
       }
     }
   }
@@ -292,12 +294,12 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
   do {
     ch->comm_type = COMM_BROADCAST;
 
-    log_dbg("Sending broadcast.\n");
+    log_printf(LOG_DEBUG, "Sending broadcast.\n");
     swab_header(ch);
 
     if(sendto(sfd, (char *)ch, sizeof(comm_header_t), 0,
 	      (struct sockaddr *)&addr, addr_size) < 0){
-      log_sys_err("Unable to perform sendto");
+      log_printf(LOG_ERR, "Unable to perform sendto");
       if(retry > 0){
 	retry--;
 	close(sfd);
@@ -315,16 +317,16 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
     tv.tv_sec = 0;
     
     tv.tv_usec = 250000 + (random()%500000);
-    log_dbg("Select waiting %ld usec\n", tv.tv_usec);
+    log_printf(LOG_DEBUG, "Select waiting %ld usec\n", tv.tv_usec);
     while((error = select(sfd+1, &rset, NULL,NULL, &tv))){
-      log_dbg("Select returns %d\n", error);
+      log_printf(LOG_DEBUG, "Select returns %d\n", error);
       if(error < 0){
-	log_sys_err("Select failed");
+	log_printf(LOG_ERR, "Select failed");
 	error = -errno;
 	goto fail;
       }
       if(error){
-	log_dbg("Checking broadcast response.\n");
+	log_printf(LOG_DEBUG, "Checking broadcast response.\n");
 	error = 0;
 	recvfrom(sfd, (char *)ch, sizeof(comm_header_t), MSG_PEEK,
 		 (struct sockaddr *)&recv_addr, (socklen_t *)&len);
@@ -349,22 +351,22 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
 	tmp_doc = xmlParseMemory(bdoc+sizeof(comm_header_t),
 				 ch->comm_payload_size);
 	if(!tmp_doc){
-	  log_err("Unable to parse remote configuration.\n");
+	  log_printf(LOG_ERR, "Unable to parse remote configuration.\n");
 	  free(bdoc); bdoc = NULL;
 	  goto reset_timer;
 	}
 
 	tmp_name = get_cluster_name(tmp_doc);
-	log_dbg("  Given cluster name = %s\n", cluster_name);
-	log_dbg("  Remote cluster name= %s\n", tmp_name);
+	log_printf(LOG_DEBUG, "  Given cluster name = %s\n", cluster_name);
+	log_printf(LOG_DEBUG, "  Remote cluster name= %s\n", tmp_name);
 	if(!tmp_name){
-	  log_err("Unable to find cluster name in remote configuration.\n");
+	  log_printf(LOG_ERR, "Unable to find cluster name in remote configuration.\n");
 	  free(bdoc); bdoc = NULL;
 	  xmlFreeDoc(tmp_doc); tmp_doc = NULL;
 	  goto reset_timer;
 	} else if(cluster_name && strcmp(cluster_name, tmp_name)){
-	  log_dbg("Remote and local configuration have different cluster names.\n");
-	  log_dbg("Skipping...\n");
+	  log_printf(LOG_DEBUG, "Remote and local configuration have different cluster names.\n");
+	  log_printf(LOG_DEBUG, "Skipping...\n");
 	  free(tmp_name); tmp_name = NULL;
 	  free(bdoc); bdoc = NULL;
 	  xmlFreeDoc(tmp_doc); tmp_doc = NULL;
@@ -373,7 +375,7 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
 	free(tmp_name); tmp_name = NULL;
 	if(!master_doc->od_doc){
 	  if((v2 = get_doc_version(tmp_doc)) >= 0){
-	    log_msg("Remote configuration copy (version = %d) found.\n", v2);
+	    log_printf(LOG_INFO, "Remote configuration copy (version = %d) found.\n", v2);
 	    master_doc->od_doc = tmp_doc;
 	    tmp_doc = NULL;
 	    write_to_disk = 1;
@@ -382,11 +384,11 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
 	  if(((v1 = get_doc_version(master_doc->od_doc)) >= 0) &&
 	     ((v2 = get_doc_version(tmp_doc)) >= 0)){
 	    if(ch->comm_flags & COMM_BROADCAST_FROM_QUORATE){
-	      log_msg("Remote configuration copy is from quorate node.\n");
-	      log_msg(" Local version # : %d\n", v1);
-	      log_msg(" Remote version #: %d\n", v2);
+	      log_printf(LOG_INFO, "Remote configuration copy is from quorate node.\n");
+	      log_printf(LOG_INFO, " Local version # : %d\n", v1);
+	      log_printf(LOG_INFO, " Remote version #: %d\n", v2);
 	      if(v1 != v2){
-		log_msg("Switching to remote copy.\n");
+		log_printf(LOG_INFO, "Switching to remote copy.\n");
 	      }
 	      if(master_doc->od_refs){
 		open_doc_t *tmp_odoc;
@@ -405,9 +407,9 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
 	      write_to_disk = 1;
 	      goto out;
 	    } else if(v2 > v1){
-	      log_msg("Remote configuration copy is newer than local copy.\n");
-	      log_msg(" Local version # : %d\n", v1);
-	      log_msg(" Remote version #: %d\n", v2);
+	      log_printf(LOG_INFO, "Remote configuration copy is newer than local copy.\n");
+	      log_printf(LOG_INFO, " Local version # : %d\n", v1);
+	      log_printf(LOG_INFO, " Remote version #: %d\n", v2);
 	      if(master_doc->od_refs){
 		open_doc_t *tmp_odoc;
 		if(!(tmp_odoc = malloc(sizeof(open_doc_t)))){
@@ -436,7 +438,7 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
     reset_timer:
       tv.tv_sec = 0;
       tv.tv_usec = 250000 + (random()%500000);
-      log_dbg("Select waiting %ld usec\n", tv.tv_usec);
+      log_printf(LOG_DEBUG, "Select waiting %ld usec\n", tv.tv_usec);
     }
   } while(blocking && !master_doc);
  out:
@@ -454,12 +456,12 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
     ** but it has not been written to disk....................................... */
     if(stat(DEFAULT_CONFIG_DIR, &stat_buf)){
       if(mkdir(DEFAULT_CONFIG_DIR, S_IRWXU | S_IRWXG)){
-	log_sys_err("Unable to create directory " DEFAULT_CONFIG_DIR);
+	log_printf(LOG_ERR, "Unable to create directory " DEFAULT_CONFIG_DIR);
 	error = -errno;
 	goto fail;
       }
     } else if(!S_ISDIR(stat_buf.st_mode)){
-      log_err(DEFAULT_CONFIG_DIR " is not a directory.\n");
+      log_printf(LOG_ERR, DEFAULT_CONFIG_DIR " is not a directory.\n");
       error = -ENOTDIR;
       goto fail;
     }
@@ -468,7 +470,7 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
     f = fopen(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE, "w");
     umask(old_mode);
     if(!f){
-      log_sys_err("Unable to open " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE);
+      log_printf(LOG_ERR, "Unable to open " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE);
       error = -errno;
       goto fail;
     }
@@ -485,7 +487,7 @@ static int broadcast_for_doc(char *cluster_name, int blocking){
   if(bdoc) free(bdoc);
   if(tmp_doc) xmlFreeDoc(tmp_doc);
   if(sfd >= 0) close(sfd);
-  EXIT("broadcast_for_doc");
+  CCSEXIT("broadcast_for_doc");
   return error;
 }
 
@@ -502,11 +504,11 @@ static int process_connect(comm_header_t *ch, char *cluster_name){
   char *tmp_name = NULL;
   time_t now;
 
-  ENTER("process_connect");
+  CCSENTER("process_connect");
 
   ch->comm_payload_size = 0;
 
-  log_dbg("Given cluster name is = %s\n", cluster_name);
+  log_printf(LOG_DEBUG, "Given cluster name is = %s\n", cluster_name);
 
   if(!ocs){
     /* this will never be freed - unless exit */
@@ -519,7 +521,7 @@ static int process_connect(comm_header_t *ch, char *cluster_name){
   }
 
   if(!quorate && !(ch->comm_flags & COMM_CONNECT_FORCE)){
-    log_msg("Cluster is not quorate.  Refusing connection.\n");
+    log_printf(LOG_INFO, "Cluster is not quorate.  Refusing connection.\n");
     error = -ECONNREFUSED;
     goto fail;
   }
@@ -538,26 +540,26 @@ static int process_connect(comm_header_t *ch, char *cluster_name){
   if(!master_doc->od_doc){
     master_doc->od_doc = xmlParseFile(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE);
     if(!master_doc->od_doc){
-      log_msg("Unable to parse " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "\n");
-      log_msg("Searching cluster for valid copy.\n");
+      log_printf(LOG_INFO, "Unable to parse " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "\n");
+      log_printf(LOG_INFO, "Searching cluster for valid copy.\n");
     } else if((error = get_doc_version(master_doc->od_doc)) < 0){
-      log_err("Unable to get config_version from " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n");
-      log_err("Discarding data and searching for valid copy.\n");
+      log_printf(LOG_ERR, "Unable to get config_version from " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n");
+      log_printf(LOG_ERR, "Discarding data and searching for valid copy.\n");
       xmlFreeDoc(master_doc->od_doc);
       master_doc->od_doc = NULL;
     } else if(!(tmp_name = get_cluster_name(master_doc->od_doc))){
-      log_err("Unable to get cluster name from " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n");
-      log_err("Discarding data and searching for valid copy.\n");
+      log_printf(LOG_ERR, "Unable to get cluster name from " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n");
+      log_printf(LOG_ERR, "Discarding data and searching for valid copy.\n");
       xmlFreeDoc(master_doc->od_doc);
       master_doc->od_doc = NULL;
     } else if(cluster_name && strcmp(cluster_name, tmp_name)){
-      log_err("Given cluster name does not match local " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n");
-      log_err("Discarding data and searching for matching copy.\n");
+      log_printf(LOG_ERR, "Given cluster name does not match local " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n");
+      log_printf(LOG_ERR, "Discarding data and searching for matching copy.\n");
       xmlFreeDoc(master_doc->od_doc);
       master_doc->od_doc = NULL;
       free(tmp_name); tmp_name = NULL;
     } else {  /* Either the names match, or a name wasn't specified. */
-      log_msg(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE " (cluster name = %s, version = %d) found.\n",
+      log_printf(LOG_INFO, DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE " (cluster name = %s, version = %d) found.\n",
 	      tmp_name, error);
       /* We must check with the others to make sure this is valid. */
     }
@@ -571,8 +573,8 @@ static int process_connect(comm_header_t *ch, char *cluster_name){
     ** for the config of the name specified............................... */
 
     if(cluster_name && strcmp(cluster_name, tmp_name)){
-      log_err("Request for configuration with cluster name, %s\n", cluster_name);
-      log_err(" However, a configuration with cluster name, %s, is already loaded.\n",
+      log_printf(LOG_ERR, "Request for configuration with cluster name, %s\n", cluster_name);
+      log_printf(LOG_ERR, " However, a configuration with cluster name, %s, is already loaded.\n",
 	      tmp_name);
       error = -EINVAL;
       goto fail;
@@ -590,32 +592,32 @@ static int process_connect(comm_header_t *ch, char *cluster_name){
     }
   }
 
-  log_dbg("Blocking is %s.\n",
+  log_printf(LOG_DEBUG, "Blocking is %s.\n",
 	  (ch->comm_flags & COMM_CONNECT_BLOCKING)? "SET": "UNSET");
-  log_dbg("Flags = 0x%x\n", ch->comm_flags);
+  log_printf(LOG_DEBUG, "Flags = 0x%x\n", ch->comm_flags);
 
   /* Need to broadcast regardless (unless quorate) to check version # */
   if(bcast_needed){
-    log_dbg("Broadcast is neccessary.\n");
+    log_printf(LOG_DEBUG, "Broadcast is neccessary.\n");
   }
   if(bcast_needed &&
      (error = broadcast_for_doc(tmp_name, ch->comm_flags & COMM_CONNECT_BLOCKING)) &&
      !master_doc->od_doc){
-    log_err("Broadcast for config file failed: %s\n", strerror(-error));
+    log_printf(LOG_ERR, "Broadcast for config file failed: %s\n", strerror(-error));
     goto fail;
   }
   error = 0;
 
   if(!master_doc || !master_doc->od_doc){
-    log_err("The appropriate config file could not be loaded.\n");
+    log_printf(LOG_ERR, "The appropriate config file could not be loaded.\n");
     error = -ENODATA;
     goto fail;
   }
 
   if(update_required){
-    log_dbg("Update is required.\n");
+    log_printf(LOG_DEBUG, "Update is required.\n");
     if((error = update_config())){
-      log_err("Failed to update config file, required by cluster.\n");
+      log_printf(LOG_ERR, "Failed to update config file, required by cluster.\n");
       /* ATTENTION -- remove all open_doc_t's ? */
       goto fail;
     }
@@ -627,7 +629,7 @@ static int process_connect(comm_header_t *ch, char *cluster_name){
     if (!ocs[i])
       continue;
     if (now >= ocs[i]->oc_expire) {
-      log_dbg("Recycling connection descriptor %d: Expired\n",
+      log_printf(LOG_DEBUG, "Recycling connection descriptor %d: Expired\n",
 	      ocs[i]->oc_desc );
       _cleanup_descriptor(i);
     }
@@ -670,7 +672,7 @@ static int process_connect(comm_header_t *ch, char *cluster_name){
   if(!ocs[i]->oc_ctx){
     ocs[i]->oc_odoc->od_refs--;
     free(ocs[i]);
-    log_err("Error: unable to create new XPath context.\n");
+    log_printf(LOG_ERR, "Error: unable to create new XPath context.\n");
     error = -EIO;  /* ATTENTION -- what should this be? */
     goto fail;
   }
@@ -690,7 +692,7 @@ static int process_connect(comm_header_t *ch, char *cluster_name){
   } else {
     ch->comm_desc = ocs[i]->oc_desc;
   }
-  EXIT("process_connect");
+  CCSEXIT("process_connect");
   return error;
 }
 
@@ -711,12 +713,12 @@ _cleanup_descriptor(int desc)
   }
   tmp_odoc = ocs[desc]->oc_odoc;
   if(tmp_odoc->od_refs < 1){
-    log_err("Number of references on an open doc should never be < 1.\n");
-    log_err("This is a fatal error.  Exiting...\n");
+    log_printf(LOG_ERR, "Number of references on an open doc should never be < 1.\n");
+    log_printf(LOG_ERR, "This is a fatal error.  Exiting...\n");
     exit(EXIT_FAILURE);
   }
   if(tmp_odoc != master_doc && tmp_odoc->od_refs == 1){
-    log_dbg("No more references on version %d of config file, freeing...\n",
+    log_printf(LOG_DEBUG, "No more references on version %d of config file, freeing...\n",
 	      get_doc_version(tmp_odoc->od_doc));
     xmlFreeDoc(tmp_odoc->od_doc);
     free(tmp_odoc);
@@ -741,20 +743,20 @@ _cleanup_descriptor(int desc)
 static int process_disconnect(comm_header_t *ch){
   int desc = dindex(ch->comm_desc);
   int error=0;
-  ENTER("process_disconnect");
+  CCSENTER("process_disconnect");
 
   ch->comm_payload_size = 0;
 
   if(desc < 0){
-    log_err("Invalid descriptor specified (%d).\n", desc);
-    log_err("Someone may be attempting something evil.\n");
+    log_printf(LOG_ERR, "Invalid descriptor specified (%d).\n", desc);
+    log_printf(LOG_ERR, "Someone may be attempting something evil.\n");
     error = -EBADR;
     goto fail;
   }
 
   if(!ocs || !ocs[desc] || (ocs[desc]->oc_desc != ch->comm_desc)){
     /* send failure to requestor ? */
-    log_err("Attempt to close an unopened CCS descriptor (%d).\n",
+    log_printf(LOG_ERR, "Attempt to close an unopened CCS descriptor (%d).\n",
 	    ch->comm_desc);
 
     error = -EBADR;
@@ -769,7 +771,7 @@ static int process_disconnect(comm_header_t *ch){
   } else {
     ch->comm_desc = -1;
   }
-  EXIT("process_disconnect");
+  CCSEXIT("process_disconnect");
   return error;
 }
 
@@ -793,33 +795,33 @@ static int _process_get(comm_header_t *ch, char **payload){
   xmlXPathObjectPtr obj = NULL;
   char *query = NULL;
 
-  ENTER("_process_get");
+  CCSENTER("_process_get");
   if(!ch->comm_payload_size){
-    log_err("process_get: payload size is zero.\n");
+    log_printf(LOG_ERR, "process_get: payload size is zero.\n");
     error = -EINVAL;
     goto fail;
   }
 
   if(ch->comm_desc < 0){
-    log_err("Invalid descriptor specified (%d).\n", ch->comm_desc);
-    log_err("Someone may be attempting something evil.\n");
+    log_printf(LOG_ERR, "Invalid descriptor specified (%d).\n", ch->comm_desc);
+    log_printf(LOG_ERR, "Someone may be attempting something evil.\n");
     error = -EBADR;
     goto fail;
   }
 
   if(!ocs || !ocs[desc] || (ocs[desc]->oc_desc != ch->comm_desc)){
-    log_err("process_get: Invalid connection descriptor received.\n");
+    log_printf(LOG_ERR, "process_get: Invalid connection descriptor received.\n");
     error = -EBADR;
     goto fail;
   }
 
   if(ocs[desc]->oc_query && !strcmp(*payload,ocs[desc]->oc_query)){
     ocs[desc]->oc_index++;
-    log_dbg("Index = %d\n",ocs[desc]->oc_index);
-    log_dbg(" Query = %s\n", *payload);
+    log_printf(LOG_DEBUG, "Index = %d\n",ocs[desc]->oc_index);
+    log_printf(LOG_DEBUG, " Query = %s\n", *payload);
   } else {
-    log_dbg("Index reset (new query).\n");
-    log_dbg(" Query = %s\n", *payload);
+    log_printf(LOG_DEBUG, "Index reset (new query).\n");
+    log_printf(LOG_DEBUG, " Query = %s\n", *payload);
     ocs[desc]->oc_index = 0;
     if(ocs[desc]->oc_query){
       free(ocs[desc]->oc_query);
@@ -831,7 +833,7 @@ static int _process_get(comm_header_t *ch, char **payload){
   if(((ch->comm_payload_size > 1) &&
       ((*payload)[0] == '/')) ||
      !ocs[desc]->oc_cwp){
-    log_dbg("Query involves absolute path or cwp is not set.\n");
+    log_printf(LOG_DEBUG, "Query involves absolute path or cwp is not set.\n");
     query = (char *)strdup(*payload);
     if(!query){
       error = -ENOMEM;
@@ -839,7 +841,7 @@ static int _process_get(comm_header_t *ch, char **payload){
     }
   } else {
     /* +2 because of NULL and '/' character */
-    log_dbg("Query involves relative path.\n");
+    log_printf(LOG_DEBUG, "Query involves relative path.\n");
     query = malloc(strlen(*payload)+strlen(ocs[desc]->oc_cwp)+2);
     if(!query){
       error = -ENOMEM;
@@ -853,8 +855,8 @@ static int _process_get(comm_header_t *ch, char **payload){
 
   obj = xmlXPathEvalExpression((xmlChar *)query, ocs[desc]->oc_ctx);
   if(obj){
-    log_dbg("Obj type  = %d (%s)\n", obj->type, (obj->type == 1)?"XPATH_NODESET":"");
-    log_dbg("Number of matches: %d\n", (obj->nodesetval)?obj->nodesetval->nodeNr:0);
+    log_printf(LOG_DEBUG, "Obj type  = %d (%s)\n", obj->type, (obj->type == 1)?"XPATH_NODESET":"");
+    log_printf(LOG_DEBUG, "Number of matches: %d\n", (obj->nodesetval)?obj->nodesetval->nodeNr:0);
     if(obj->nodesetval && (obj->nodesetval->nodeNr > 0) ){
       xmlNodePtr node;
       int size=0;
@@ -863,17 +865,17 @@ static int _process_get(comm_header_t *ch, char **payload){
       if(ocs[desc]->oc_index >= obj->nodesetval->nodeNr){
 	ocs[desc]->oc_index = 0;
 	error = 1;
-	log_dbg("Index reset to zero (end of list).\n");
+	log_printf(LOG_DEBUG, "Index reset to zero (end of list).\n");
       }
 	  
       node = obj->nodesetval->nodeTab[ocs[desc]->oc_index];
 	
-      log_dbg("Node (%s) type = %d (%s)\n", node->name, node->type,
+      log_printf(LOG_DEBUG, "Node (%s) type = %d (%s)\n", node->name, node->type,
 	      (node->type == 1)? "XML_ELEMENT_NODE":
 	      (node->type == 2)? "XML_ATTRIBUTE_NODE":"");
 
       if(!node) {
-	log_dbg("No content found.\n");
+	log_printf(LOG_DEBUG, "No content found.\n");
 	error = -ENODATA;
 	goto fail;
       }
@@ -898,7 +900,7 @@ static int _process_get(comm_header_t *ch, char **payload){
       }
 
       if(size <= ch->comm_payload_size){  /* do we already have enough space? */
-	log_dbg("No extra space needed.\n");
+	log_printf(LOG_DEBUG, "No extra space needed.\n");
 	if(nnv){
  	  sprintf(*payload, "%s=%s", node->name, node->children ?
  					 (char *)node->children->content:"");
@@ -908,7 +910,7 @@ static int _process_get(comm_header_t *ch, char **payload){
 	}
 
       } else {
-	log_dbg("Extra space needed.\n");
+	log_printf(LOG_DEBUG, "Extra space needed.\n");
 	free(*payload);
 	*payload = (char *)malloc(size);
 	if(!*payload){
@@ -923,16 +925,16 @@ static int _process_get(comm_header_t *ch, char **payload){
  				  node->name);
 	}
       }
-      log_dbg("Query results:: %s\n", *payload);
+      log_printf(LOG_DEBUG, "Query results:: %s\n", *payload);
       ch->comm_payload_size = size;
     } else {
-      log_dbg("No nodes found.\n");
+      log_printf(LOG_DEBUG, "No nodes found.\n");
       ch->comm_payload_size = 0;
       error = -ENODATA;
       goto fail;
     }
   } else {
-    log_err("Error: unable to evaluate xpath query \"%s\"\n", *payload);
+    log_printf(LOG_ERR, "Error: unable to evaluate xpath query \"%s\"\n", *payload);
     error = -EINVAL;
     goto fail;
   }
@@ -946,23 +948,23 @@ static int _process_get(comm_header_t *ch, char **payload){
     ch->comm_payload_size = 0;
   }
   if(query) { free(query); }
-  EXIT("_process_get");
+  CCSEXIT("_process_get");
   return error;
 }
 
 static int process_get(comm_header_t *ch, char **payload){
   int error;
-  ENTER("process_get");
+  CCSENTER("process_get");
 
   error = _process_get(ch, payload);
 
-  EXIT("process_get");
+  CCSEXIT("process_get");
   return (error < 0)? error: 0;  
 }
 
 static int process_get_list(comm_header_t *ch, char **payload){
   int error;
-  ENTER("process_get_list");
+  CCSENTER("process_get_list");
 
   error = _process_get(ch, payload);
   if(error){
@@ -971,7 +973,7 @@ static int process_get_list(comm_header_t *ch, char **payload){
       ocs[dindex(ch->comm_desc)]->oc_index = -1;
   }
 
-  EXIT("process_get_list");
+  CCSEXIT("process_get_list");
   return (error < 0)? error: 0;
 }
 
@@ -979,22 +981,22 @@ static int process_set(comm_header_t *ch, char *payload){
   int error = 0;
   int desc = dindex(ch->comm_desc);
 
-  ENTER("process_set");
+  CCSENTER("process_set");
   if(!ch->comm_payload_size){
-    log_err("process_set: payload size is zero.\n");
+    log_printf(LOG_ERR, "process_set: payload size is zero.\n");
     error = -EINVAL;
     goto fail;
   }
 
   if(ch->comm_desc < 0){
-    log_err("Invalid descriptor specified (%d).\n", ch->comm_desc);
-    log_err("Someone may be attempting something evil.\n");
+    log_printf(LOG_ERR, "Invalid descriptor specified (%d).\n", ch->comm_desc);
+    log_printf(LOG_ERR, "Someone may be attempting something evil.\n");
     error = -EBADR;
     goto fail;
   }
 
   if(!ocs || !ocs[desc] || (ocs[desc]->oc_desc != ch->comm_desc)){
-    log_err("process_set: Invalid connection descriptor received.\n");
+    log_printf(LOG_ERR, "process_set: Invalid connection descriptor received.\n");
     error = -EBADR;
     goto fail;
   }
@@ -1007,7 +1009,7 @@ static int process_set(comm_header_t *ch, char *payload){
   if(error){
     ch->comm_error = error;
   }
-  EXIT("process_set");
+  CCSEXIT("process_set");
   return error;
 }
 
@@ -1016,22 +1018,22 @@ static int process_get_state(comm_header_t *ch, char **payload){
   int error = 0, desc = dindex(ch->comm_desc);
   char *load = NULL;
 
-  ENTER("process_get_state");
+  CCSENTER("process_get_state");
   if(ch->comm_payload_size){
-    log_err("process_get_state: payload size is nonzero.\n");
+    log_printf(LOG_ERR, "process_get_state: payload size is nonzero.\n");
     error = -EINVAL;
     goto fail;
   }
 
   if(ch->comm_desc < 0){
-    log_err("Invalid descriptor specified (%d).\n", ch->comm_desc);
-    log_err("Someone may be attempting something evil.\n");
+    log_printf(LOG_ERR, "Invalid descriptor specified (%d).\n", ch->comm_desc);
+    log_printf(LOG_ERR, "Someone may be attempting something evil.\n");
     error = -EBADR;
     goto fail;
   }
 
   if(!ocs || !ocs[desc] || (ocs[desc]->oc_desc != ch->comm_desc)){
-    log_err("process_get_state: Invalid connection descriptor received.\n");
+    log_printf(LOG_ERR, "process_get_state: Invalid connection descriptor received.\n");
     error = -EBADR;
     goto fail;
   }
@@ -1039,7 +1041,7 @@ static int process_get_state(comm_header_t *ch, char **payload){
   if(ocs[desc]->oc_cwp && ocs[desc]->oc_query){
     int size = strlen(ocs[desc]->oc_cwp) +
       strlen(ocs[desc]->oc_query) + 2;
-    log_dbg("Both cwp and query are set.\n");
+    log_printf(LOG_DEBUG, "Both cwp and query are set.\n");
     load = malloc(size);
     if(!load){
       error = -ENOMEM;
@@ -1049,7 +1051,7 @@ static int process_get_state(comm_header_t *ch, char **payload){
     strcpy(load+strlen(ocs[desc]->oc_cwp)+1, ocs[desc]->oc_query);
     ch->comm_payload_size = size;
   } else if(ocs[desc]->oc_cwp){
-    log_dbg("Only cwp is set.\n");
+    log_printf(LOG_DEBUG, "Only cwp is set.\n");
     load = (char *)strdup(ocs[desc]->oc_cwp);
     if(!load){
       error = -ENOMEM;
@@ -1058,7 +1060,7 @@ static int process_get_state(comm_header_t *ch, char **payload){
     ch->comm_payload_size = strlen(load)+1;
   } else if(ocs[desc]->oc_query){
     int size = strlen(ocs[desc]->oc_query) + 2;
-    log_dbg("Only query is set.\n");
+    log_printf(LOG_DEBUG, "Only query is set.\n");
     load = malloc(size);
     if(!load){
       error = -ENOMEM;
@@ -1078,7 +1080,7 @@ static int process_get_state(comm_header_t *ch, char **payload){
     ch->comm_error = error;
     ch->comm_payload_size = 0;
   }
-  EXIT("process_get_state");
+  CCSEXIT("process_get_state");
   return error;
 }
 
@@ -1086,22 +1088,22 @@ static int process_get_state(comm_header_t *ch, char **payload){
 static int process_set_state(comm_header_t *ch, char *payload){
   int error = 0, desc = dindex(ch->comm_desc);
 
-  ENTER("process_set_state");
+  CCSENTER("process_set_state");
   if(!ch->comm_payload_size){
-    log_err("process_set_state: payload size is zero.\n");
+    log_printf(LOG_ERR, "process_set_state: payload size is zero.\n");
     error = -EINVAL;
     goto fail;
   }
 
   if(ch->comm_desc < 0){
-    log_err("Invalid descriptor specified (%d).\n", ch->comm_desc);
-    log_err("Someone may be attempting something evil.\n");
+    log_printf(LOG_ERR, "Invalid descriptor specified (%d).\n", ch->comm_desc);
+    log_printf(LOG_ERR, "Someone may be attempting something evil.\n");
     error = -EBADR;
     goto fail;
   }
 
   if(!ocs || !ocs[desc] || (ocs[desc]->oc_desc != ch->comm_desc)){
-    log_err("process_set_state: Invalid connection descriptor received.\n");
+    log_printf(LOG_ERR, "process_set_state: Invalid connection descriptor received.\n");
     error = -EBADR;
     goto fail;
   }
@@ -1125,7 +1127,7 @@ static int process_set_state(comm_header_t *ch, char *payload){
     ch->comm_error = error;
   }
 
-  EXIT("process_set_state");
+  CCSEXIT("process_set_state");
   return error;
 }
 
@@ -1144,7 +1146,7 @@ int process_request(int afd){
   comm_header_t *ch = NULL, *tmp_ch;
   char *payload = NULL;
   
-  ENTER("process_request");
+  CCSENTER("process_request");
 
   if(!(ch = (comm_header_t *)malloc(sizeof(comm_header_t)))){
     error = -ENOMEM;
@@ -1153,10 +1155,10 @@ int process_request(int afd){
 
   error = read(afd, ch, sizeof(comm_header_t));
   if(error < 0){
-    log_sys_err("Unable to read comm_header_t");
+    log_printf(LOG_ERR, "Unable to read comm_header_t");
     goto fail;
   } else if(error < sizeof(comm_header_t)){
-    log_err("Unable to read complete comm_header_t.\n");
+    log_printf(LOG_ERR, "Unable to read complete comm_header_t.\n");
     error = -EBADE;
     goto fail;
   }
@@ -1168,10 +1170,10 @@ int process_request(int afd){
     }
     error = read(afd, payload, ch->comm_payload_size);
     if(error < 0){
-      log_sys_err("Unable to read payload");
+      log_printf(LOG_ERR, "Unable to read payload");
       goto fail;
     } else if(error < ch->comm_payload_size){
-      log_err("Unable to read complete payload.\n");
+      log_printf(LOG_ERR, "Unable to read complete payload.\n");
       error = -EBADE;
       goto fail;
     }
@@ -1180,20 +1182,20 @@ int process_request(int afd){
   switch(ch->comm_type){
   case COMM_CONNECT:
     if((error = process_connect(ch, payload)) < 0){
-      log_err("Error while processing connect: %s\n", strerror(-error));
+      log_printf(LOG_ERR, "Error while processing connect: %s\n", strerror(-error));
       goto fail;
     }
     break;
   case COMM_DISCONNECT:
     if((error = process_disconnect(ch)) < 0){
-      log_err("Error while processing disconnect: %s\n", strerror(-error));
+      log_printf(LOG_ERR, "Error while processing disconnect: %s\n", strerror(-error));
       goto fail;
     }
     break;
   case COMM_GET:
     if((error = process_get(ch, &payload)) < 0){
       if(error != -ENODATA){
-	log_err("Error while processing get: %s\n", strerror(-error));
+	log_printf(LOG_ERR, "Error while processing get: %s\n", strerror(-error));
       }
       goto fail;
     }
@@ -1201,43 +1203,43 @@ int process_request(int afd){
   case COMM_GET_LIST:
     if((error = process_get_list(ch, &payload)) < 0){
       if(error != -ENODATA){
-	log_err("Error while processing get: %s\n", strerror(-error));
+	log_printf(LOG_ERR, "Error while processing get: %s\n", strerror(-error));
       }
       goto fail;
     }
     break;
   case COMM_SET:
     if((error = process_set(ch, payload)) < 0){
-      log_err("Error while processing set: %s\n", strerror(-error));
+      log_printf(LOG_ERR, "Error while processing set: %s\n", strerror(-error));
       goto fail;
     }
     break;
   case COMM_GET_STATE:
     if((error = process_get_state(ch, &payload)) < 0){
-      log_err("Error while processing get_state: %s\n", strerror(-error));
+      log_printf(LOG_ERR, "Error while processing get_state: %s\n", strerror(-error));
       goto fail;
     }
     break;
   case COMM_SET_STATE:
     if((error = process_set_state(ch, payload)) < 0){
-      log_err("Error while processing set_state: %s\n", strerror(-error));
+      log_printf(LOG_ERR, "Error while processing set_state: %s\n", strerror(-error));
       goto fail;
     }
     break;
   default:
-    log_err("Unknown connection request received.\n");
+    log_printf(LOG_ERR, "Unknown connection request received.\n");
     error = -EINVAL;
     ch->comm_error = error;
     ch->comm_payload_size = 0;
   }
 
   if(ch->comm_payload_size){
-    log_dbg("Reallocating transfer buffer.\n");
+    log_printf(LOG_DEBUG, "Reallocating transfer buffer.\n");
     tmp_ch = (comm_header_t *)
       realloc(ch,sizeof(comm_header_t)+ch->comm_payload_size);
 
     if(tmp_ch) { ch = tmp_ch; } else {
-      log_err("Not enough memory to complete request.\n");
+      log_printf(LOG_ERR, "Not enough memory to complete request.\n");
       error = -ENOMEM;
       goto fail;
     }
@@ -1252,10 +1254,10 @@ int process_request(int afd){
     if (errno == EPIPE) {
       error = 0;
     } else {
-      log_sys_err("Unable to write package back to sender");
+      log_printf(LOG_ERR, "Unable to write package back to sender");
     }
   } else if(error < (sizeof(comm_header_t)+ch->comm_payload_size)){
-    log_err("Unable to write complete package.\n");
+    log_printf(LOG_ERR, "Unable to write complete package.\n");
     error = -EBADE;
     goto fail;
   } else {
@@ -1265,7 +1267,7 @@ int process_request(int afd){
   if(ch){ free(ch); }
   if(payload){ free(payload); }
 
-  EXIT("process_request");
+  CCSEXIT("process_request");
   return error;
 }
 
@@ -1286,7 +1288,7 @@ int process_broadcast(int sfd){
   int sendlen;
   int discard = 0;
 
-  ENTER("process_broadcast");
+  CCSENTER("process_broadcast");
 
   ch = malloc(sizeof(comm_header_t));
   if(!ch){
@@ -1296,9 +1298,9 @@ int process_broadcast(int sfd){
   memset(ch, 0, sizeof(comm_header_t));
   memset(&addr, 0, sizeof(struct sockaddr_storage)); /* just to make sure */
 
-  log_dbg("Waiting to receive broadcast request.\n");
+  log_printf(LOG_DEBUG, "Waiting to receive broadcast request.\n");
   if(recvfrom(sfd, ch, sizeof(comm_header_t), 0, (struct sockaddr *)&addr, &len) < 0){
-    log_sys_err("Unable to perform recvfrom");
+    log_printf(LOG_ERR, "Unable to perform recvfrom");
     error = -errno;
     goto fail;
   }
@@ -1308,7 +1310,7 @@ int process_broadcast(int sfd){
     /* Either someone is pinging this port, or there is an older version **
     ** of ccs trying to get bcast response.  Either way, we should not   **
     ** respond to them.................................................. */
-    log_dbg("Received invalid request on broadcast port. %x\n",ch->comm_type);
+    log_printf(LOG_DEBUG, "Received invalid request on broadcast port. %x\n",ch->comm_type);
     error = -EINVAL;
     goto fail;
   }
@@ -1321,7 +1323,7 @@ int process_broadcast(int sfd){
 
   if(!master_doc){
     discard = 1;
-    log_dbg("master_doc not loaded.  Attempting to load it.\n");
+    log_printf(LOG_DEBUG, "master_doc not loaded.  Attempting to load it.\n");
     if(!(master_doc = malloc(sizeof(open_doc_t)))){
       error = -ENOMEM;
       goto fail;
@@ -1331,15 +1333,15 @@ int process_broadcast(int sfd){
     if(!master_doc->od_doc){
       free(master_doc);
       master_doc = NULL;
-      log_err("Unable to parse " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n");
+      log_printf(LOG_ERR, "Unable to parse " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n");
       error = -ENODATA;
       goto fail;
     }
-    log_dbg("master_doc found and loaded.\n");
+    log_printf(LOG_DEBUG, "master_doc found and loaded.\n");
   } else if(update_required){
-    log_dbg("Update is required.\n");
+    log_printf(LOG_DEBUG, "Update is required.\n");
     if((error = update_config())){
-      log_err("Failed to update config file, required by cluster.\n");
+      log_printf(LOG_ERR, "Failed to update config file, required by cluster.\n");
       /* ATTENTION -- remove all open_doc_t's ? */
       goto fail;
     }
@@ -1352,7 +1354,7 @@ int process_broadcast(int sfd){
 			 0);
   if(!ch->comm_payload_size){
     error = -ENOMEM;
-    log_err("Document dump to memory failed.\n");
+    log_printf(LOG_ERR, "Document dump to memory failed.\n");
     goto fail;
   }
 
@@ -1371,11 +1373,11 @@ int process_broadcast(int sfd){
   swab_header(ch); /* Swab back to dip into ch for payload_size */
   memcpy(buffer+sizeof(comm_header_t), payload, ch->comm_payload_size);
 
-  log_dbg("Sending configuration (version %d)...\n", get_doc_version(master_doc->od_doc));
+  log_printf(LOG_DEBUG, "Sending configuration (version %d)...\n", get_doc_version(master_doc->od_doc));
   sendlen = ch->comm_payload_size + sizeof(comm_header_t);
   if(sendto(sfd, buffer, sendlen, 0,
 	    (struct sockaddr *)&addr, (socklen_t)len) < 0){
-    log_sys_err("Sendto failed");
+    log_printf(LOG_ERR, "Sendto failed");
     error = -errno;
   }
 
@@ -1389,6 +1391,6 @@ int process_broadcast(int sfd){
     if(master_doc) free(master_doc);
     master_doc = NULL;
   }
-  EXIT("process_broadcast");
+  CCSEXIT("process_broadcast");
   return error;
 }
diff --git a/ccs/daemon/misc.c b/ccs/daemon/misc.c
index 6907268..54b94ef 100644
--- a/ccs/daemon/misc.c
+++ b/ccs/daemon/misc.c
@@ -28,9 +28,9 @@
 #include <libxml/tree.h>
 #include <libxml/xpath.h>
 #include <libxml/xpathInternals.h>
+#include <openais/service/logsys.h>
 
 #include "comm_headers.h"
-#include "log.h"
 #include "debug.h"
 #include "misc.h"
 
@@ -41,6 +41,8 @@ pthread_mutex_t update_lock;
 
 open_doc_t *master_doc = NULL;
 
+LOGSYS_DECLARE_SUBSYS ("CCS", LOG_INFO);
+
 int get_doc_version(xmlDocPtr ldoc){
   int i;
   int error = 0;
@@ -48,38 +50,38 @@ int get_doc_version(xmlDocPtr ldoc){
   xmlXPathContextPtr ctx = NULL;
   xmlNodePtr        node = NULL;
 
-  ENTER("get_doc_version");
+  CCSENTER("get_doc_version");
 
   ctx = xmlXPathNewContext(ldoc);
   if(!ctx){
-    log_err("Error: unable to create new XPath context.\n");
+    log_printf(LOG_ERR, "Error: unable to create new XPath context.\n");
     error = -EIO;  /* ATTENTION -- what should this be? */
     goto fail;
   }
 
   obj = xmlXPathEvalExpression((xmlChar *)"//cluster/@config_version", ctx);
   if(!obj || !obj->nodesetval || (obj->nodesetval->nodeNr != 1)){
-    log_err("Error while retrieving config_version.\n");
+    log_printf(LOG_ERR, "Error while retrieving config_version.\n");
     error = -ENODATA;
     goto fail;
   }
 
   node = obj->nodesetval->nodeTab[0];
   if(node->type != XML_ATTRIBUTE_NODE){
-    log_err("Object returned is not of attribute type.\n");
+    log_printf(LOG_ERR, "Object returned is not of attribute type.\n");
     error = -ENODATA;
     goto fail;
   }
 
   if(!node->children->content || !strlen((char *)node->children->content)){
-    log_dbg("No content found.\n");
+    log_printf(LOG_DEBUG, "No content found.\n");
     error = -ENODATA;
     goto fail;
   }
   
   for(i=0; i < strlen((char *)node->children->content); i++){
     if(!isdigit(node->children->content[i])){
-      log_err("config_version is not a valid integer.\n");
+      log_printf(LOG_ERR, "config_version is not a valid integer.\n");
       error = -EINVAL;
       goto fail;
     }
@@ -94,7 +96,7 @@ fail:
   if(obj){
     xmlXPathFreeObject(obj);
   }
-  EXIT("get_doc_version");
+  CCSEXIT("get_doc_version");
   return error;
 }
 
@@ -114,31 +116,31 @@ char *get_cluster_name(xmlDocPtr ldoc){
   xmlXPathContextPtr ctx = NULL;
   xmlNodePtr        node = NULL;
 
-  ENTER("get_cluster_name");
+  CCSENTER("get_cluster_name");
 
   ctx = xmlXPathNewContext(ldoc);
   if(!ctx){
-    log_err("Error: unable to create new XPath context.\n");
+    log_printf(LOG_ERR, "Error: unable to create new XPath context.\n");
     error = -EIO;  /* ATTENTION -- what should this be? */
     goto fail;
   }
 
   obj = xmlXPathEvalExpression((xmlChar *)"//cluster/@name", ctx);
   if(!obj || !obj->nodesetval || (obj->nodesetval->nodeNr != 1)){
-    log_err("Error while retrieving config_version.\n");
+    log_printf(LOG_ERR, "Error while retrieving config_version.\n");
     error = -ENODATA;
     goto fail;
   }
 
   node = obj->nodesetval->nodeTab[0];
   if(node->type != XML_ATTRIBUTE_NODE){
-    log_err("Object returned is not of attribute type.\n");
+    log_printf(LOG_ERR, "Object returned is not of attribute type.\n");
     error = -ENODATA;
     goto fail;
   }
 
   if(!node->children->content || !strlen((char *)node->children->content)){
-    log_dbg("No content found.\n");
+    log_printf(LOG_DEBUG, "No content found.\n");
     error = -ENODATA;
     goto fail;
   }
@@ -153,7 +155,7 @@ fail:
   if(obj){
     xmlXPathFreeObject(obj);
   }
-  EXIT("get_cluster_name");
+  CCSEXIT("get_cluster_name");
   return rtn;
 }
 
diff --git a/ccs/include/debug.h b/ccs/include/debug.h
index 176ab48..49af319 100644
--- a/ccs/include/debug.h
+++ b/ccs/include/debug.h
@@ -1,7 +1,7 @@
 /******************************************************************************
 *******************************************************************************
 **
-**  Copyright (C) 2004 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
 **
 **  This copyrighted material is made available to anyone wishing to use,
 **  modify, copy, or redistribute it subject to the terms and conditions
@@ -13,12 +13,7 @@
 #ifndef __DEBUG_DOT_H__
 #define __DEBUG_DOT_H__
 
-#ifdef DEBUG
-#define ENTER(x) log_dbg("Entering %s\n", x)
-#define EXIT(x) log_dbg("Exiting %s\n", x)
-#else
-#define ENTER(x)
-#define EXIT(x)
-#endif
+#define CCSENTER(x) log_printf(LOG_DEBUG, "Entering " x "\n")
+#define CCSEXIT(x) log_printf(LOG_DEBUG, "Exiting " x "\n")
 
 #endif /* __DEBUG_DOT_H__ */
diff --git a/ccs/lib/Makefile b/ccs/lib/Makefile
index 63d32f0..820342f 100644
--- a/ccs/lib/Makefile
+++ b/ccs/lib/Makefile
@@ -1,7 +1,7 @@
 ###############################################################################
 ###############################################################################
 ##
-##  Copyright (C) 2004 Red Hat, Inc.  All rights reserved.
+##  Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
 ##
 ##  This copyrighted material is made available to anyone wishing to use,
 ##  modify, copy, or redistribute it subject to the terms and conditions
@@ -23,12 +23,11 @@ include $(OBJDIR)/make/clean.mk
 include $(OBJDIR)/make/install.mk
 include $(OBJDIR)/make/uninstall.mk
 
-OBJS=	libccs.o \
-	log.o
+OBJS=	libccs.o
 
 CFLAGS += -D_FILE_OFFSET_BITS=64
 CFLAGS += -fPIC
-CFLAGS += -I$(S)/../include -I$(S)/../common
+CFLAGS += -I$(S)/../include
 CFLAGS += -I${incdir}
 
 
@@ -36,10 +35,6 @@ ${TARGET}: ${OBJS}
 	${AR} cr $@ $^
 	${RANLIB} $@
 
-log.c:
-	ln -sf $(S)/../common/log.c log.c
-
 clean: generalclean
-	rm -rf ccs.h.gch log.c
 
 -include $(OBJS:.o=.d)
diff --git a/ccs/lib/libccs.c b/ccs/lib/libccs.c
index 3c1c451..ad566d8 100644
--- a/ccs/lib/libccs.c
+++ b/ccs/lib/libccs.c
@@ -1,7 +1,7 @@
 /******************************************************************************
 *******************************************************************************
 **
-**  Copyright (C) 2004-2007 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
 **
 **  This copyrighted material is made available to anyone wishing to use,
 **  modify, copy, or redistribute it subject to the terms and conditions
@@ -21,7 +21,6 @@
 #include <ctype.h>
 #include <errno.h>
 
-#include "log.h" /* Libraries should not print - so only use log_dbg */
 #include "debug.h"
 #include "comm_headers.h"
 #include "ccs.h"
@@ -37,7 +36,6 @@ static int setup_interface_ipv6(int *sp, int port){
   struct sockaddr_in6 addr;
   int trueint = 1;
 
-  ENTER("setup_interface_ipv6");
   memset(&addr, 0, sizeof(struct sockaddr_in6));
 
   sock = socket(PF_INET6, SOCK_STREAM, 0);
@@ -46,17 +44,13 @@ static int setup_interface_ipv6(int *sp, int port){
     goto fail;
   }
 
-  if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &trueint, sizeof(int))){
-    log_sys_err("Unable to set socket option SO_REUSEADDR");
-    log_err("This may slow things down a bit.\n");
-  }
+  setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &trueint, sizeof(int));
 
   addr.sin6_family = AF_INET6;
   addr.sin6_port = htons(port);
   addr.sin6_addr = in6addr_loopback;
 
   if(bind(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in6))){
-    log_dbg("Unable to (pre)bind to port %d: %s\n", port, strerror(errno));
     error = -errno;
     goto fail;
   }
@@ -67,20 +61,17 @@ static int setup_interface_ipv6(int *sp, int port){
   error = connect(sock, (struct sockaddr *)&addr,
 		  sizeof(struct sockaddr_in6));
   if(error < 0){
-    log_dbg("Unable to connect to server: %s\n", strerror(errno));
     error = -errno;
     goto fail;
   }
 
   *sp = sock;
-  EXIT("setup_interface_ipv6");
   return 0;
 
  fail:
   if(sock >= 0){
     close(sock);
   }
-  EXIT("setup_interface_ipv6");
   return error;
 }
 
@@ -89,8 +80,6 @@ static int setup_interface_ipv4(int *sp, int port){
   int error = 0;
   struct sockaddr_in addr;
 
-  ENTER("setup_interface_ipv4");
-
   memset(&addr, 0, sizeof(struct sockaddr_in));
   sock = socket(PF_INET, SOCK_STREAM, 0);
   if(sock < 0){
@@ -103,7 +92,6 @@ static int setup_interface_ipv4(int *sp, int port){
   addr.sin_port = htons(port);
 
   if(bindresvport(sock, &addr)){
-    log_dbg("Unable to bindresvport: %s\n", strerror(errno));
     error = -errno;
     goto fail;
   }
@@ -114,20 +102,17 @@ static int setup_interface_ipv4(int *sp, int port){
   error = connect(sock, (struct sockaddr *)&addr,
 		  sizeof(struct sockaddr_in));
   if(error < 0){
-    log_dbg("Unable to connect to server: %s\n", strerror(errno));
     error = -errno;
     goto fail;
   }
 
   *sp = sock;
-  EXIT("setup_interface_ipv4");
   return 0;
 
  fail:
   if(sock >= 0){
     close(sock);
   }
-  EXIT("setup_interface_ipv4");
   return error;
 }
 
@@ -138,7 +123,6 @@ setup_interface_local(int *sp)
   struct sockaddr_un sun;
   int sock = -1, error = 0;
 
-  ENTER("setup_interface_local");
   sun.sun_family = PF_LOCAL;
   snprintf(sun.sun_path, sizeof(sun.sun_path), COMM_LOCAL_SOCKET);
 
@@ -155,14 +139,12 @@ setup_interface_local(int *sp)
   }
 
   *sp = sock;
-  EXIT("setup_interface_local");
   return PF_LOCAL;
 
 fail:
   if (sock >= 0){
     close(sock);
   }
-  EXIT("setup_interface_local");
   return -error;
 }
 
@@ -184,7 +166,6 @@ static int setup_interface(int *sp){
   int ipv6 = (comm_proto < 0) ? 1 : (comm_proto == PF_INET6);
   int local = (comm_proto < 0) ? 1 : (comm_proto == PF_LOCAL);
 
-  ENTER("setup_interface");
   srandom(getpid());
 
   /* Try to do a local connect first */
@@ -213,7 +194,6 @@ static int setup_interface(int *sp){
       sleep(timo);
     }
   }
-  EXIT("setup_interface");
   return error;
 }
 
@@ -233,8 +213,6 @@ static int do_request(char *buffer){
   char *proto;
   comm_header_t *ch = (comm_header_t *)buffer;
  
-  ENTER("do_request");
-
   if((error = setup_interface(&sock)) < 0){
     goto fail;
   }
@@ -252,15 +230,12 @@ static int do_request(char *buffer){
     }
 
     comm_proto = error;
-    log_dbg("Protocol set to %s.\n", proto);
   }
 
   error = write(sock, buffer, sizeof(comm_header_t)+ch->comm_payload_size);
   if(error < 0){
-    log_dbg("Write to socket failed.\n");
     goto fail;
   } else if(error < (sizeof(comm_header_t)+ch->comm_payload_size)){
-    log_dbg("Failed to write full package to socket.\n");
     error = -EBADE;
     goto fail;
   }
@@ -268,14 +243,11 @@ static int do_request(char *buffer){
   /* ok to take in two passes ? */
   error = read(sock, buffer, sizeof(comm_header_t));
   if(error < 0){
-    log_dbg("Read from socket failed.\n");
     goto fail;
   } else if(error < sizeof(comm_header_t)){
-    log_dbg("Failed to read complete comm_header_t.\n");
     error = -EBADE;
     goto fail;
   } else if(ch->comm_error){
-    log_dbg("Server reports failure: %s\n", strerror(-ch->comm_error));
     error = ch->comm_error;
     goto fail;
   } else {
@@ -284,10 +256,8 @@ static int do_request(char *buffer){
   if(ch->comm_payload_size){
     error = read(sock, buffer+sizeof(comm_header_t), ch->comm_payload_size);
     if(error < 0){
-      log_dbg("Read from socket failed.\n");
       goto fail;
     } else if(error < ch->comm_payload_size){
-      log_dbg("Failed to read complete payload.\n");
       error = -EBADE;
       goto fail;
     } else {
@@ -296,7 +266,6 @@ static int do_request(char *buffer){
   }
  fail:
   if(sock >= 0) { close(sock); }
-  EXIT("do_request");
   return error;
 }
 
@@ -317,8 +286,6 @@ int _ccs_connect(const char *cluster_name, int flags){
   comm_header_t *ch = NULL;
   char *payload = NULL;
 
-  ENTER("ccs_connect");
-
   if(!(buffer = malloc(512))){
     error = -ENOMEM;
     goto fail;
@@ -354,7 +321,6 @@ int _ccs_connect(const char *cluster_name, int flags){
 
  fail:
   if(buffer) { free(buffer); }
-  EXIT("ccs_connect");
   return error;
 }
 
@@ -408,8 +374,6 @@ int ccs_disconnect(int desc){
   comm_header_t *ch = NULL;
   char *payload = NULL;
 
-  ENTER("ccs_disconnect");
-
   if (desc < 0)
 	  return -EINVAL;
 
@@ -430,7 +394,6 @@ int ccs_disconnect(int desc){
  fail:
   if(buffer) { free(buffer); }
 
-  EXIT("ccs_disconnect");
   return error;
 }
 
@@ -454,8 +417,6 @@ int _ccs_get(int desc, const char *query, char **rtn, int list){
   comm_header_t *ch = NULL;
   char *payload = NULL;
 
-  ENTER("_ccs_get");
-
   if (desc < 0)
 	  return -EINVAL;
 
@@ -468,7 +429,6 @@ int _ccs_get(int desc, const char *query, char **rtn, int list){
   ch = (comm_header_t *)buffer;
   payload = (buffer + sizeof(comm_header_t));
 
-  log_dbg("ccs_get list? %s\n", (list)?"YES":"NO");
   ch->comm_type = (list)?COMM_GET_LIST:COMM_GET;
   ch->comm_desc = desc;
 
@@ -488,7 +448,6 @@ int _ccs_get(int desc, const char *query, char **rtn, int list){
  fail:
   if(buffer) { free(buffer); }
 
-  EXIT("_ccs_get");
   return error;
 }
 
@@ -516,8 +475,6 @@ int ccs_get_list(int desc, const char *query, char **rtn){
  * Returns: 0 on success, < 0 on failure
  */
 int ccs_set(int desc, const char *path, char *val){
-  ENTER("ccs_set");
-  EXIT("ccs_set");
   return -ENOSYS;
 }
 
@@ -540,8 +497,6 @@ int ccs_get_state(int desc, char **cw_path, char **prev_query){
   comm_header_t *ch = NULL;
   char *payload = NULL;
 
-  ENTER("ccs_get_state");
-
   if (desc < 0)
 	  return -EINVAL;
 
@@ -578,7 +533,6 @@ int ccs_get_state(int desc, char **cw_path, char **prev_query){
  fail:
   if(buffer) { free(buffer); }
 
-  EXIT("ccs_get_state");
   return error;
 }
 
@@ -602,8 +556,6 @@ int ccs_set_state(int desc, const char *cw_path, int reset_query){
   comm_header_t *ch = NULL;
   char *payload = NULL;
 
-  ENTER("ccs_set_state");
-
   if (desc < 0)
 	  return -EINVAL;
 
@@ -636,7 +588,6 @@ int ccs_set_state(int desc, const char *cw_path, int reset_query){
  fail:
   if(buffer) { free(buffer); }
 
-  EXIT("ccs_set_state");
   return error;
 }
 


hooks/post-receive
--
Cluster Project


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]