Re: [PATCH 3/7] CTS: convert the test agents to use qb logging

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

 



Reviewed-by: Steven Dake <sdake@xxxxxxxxxx>

On 01/22/2012 05:37 PM, Angus Salkeld wrote:
> Signed-off-by: Angus Salkeld <asalkeld@xxxxxxxxxx>
> ---
>  cts/agents/common_test_agent.c     |   51 +++--
>  cts/agents/common_test_agent.h     |    4 +-
>  cts/agents/cpg_test_agent.c        |   14 +-
>  cts/agents/sam_test_agent.c        |  477 ++++++++++++++++++------------------
>  cts/agents/votequorum_test_agent.c |   56 ++---
>  5 files changed, 295 insertions(+), 307 deletions(-)
> 
> diff --git a/cts/agents/common_test_agent.c b/cts/agents/common_test_agent.c
> index 2455e4a..51266f5 100644
> --- a/cts/agents/common_test_agent.c
> +++ b/cts/agents/common_test_agent.c
> @@ -43,13 +43,11 @@
>  #include <netinet/in.h>
>  #include <arpa/inet.h>
>  #include <netdb.h>
> -#include <syslog.h>
>  #include <poll.h>
>  #include <unistd.h>
>  #include <fcntl.h>
> -#include <qb/qbloop.h>
> -#include "common_test_agent.h"
>  
> +#include "common_test_agent.h"
>  
>  int32_t parse_debug = 0;
>  static char big_and_buf_rx[HOW_BIG_AND_BUF];
> @@ -84,7 +82,7 @@ static void ta_handle_command (int sock, char* msg)
>  	char* func = NULL;
>  
>  	if (parse_debug)
> -		syslog (LOG_DEBUG,"%s (MSG:%s)\n", __func__, msg);
> +		qb_log (LOG_DEBUG,"%s (MSG:%s)\n", __func__, msg);
>  
>  	str_len = strtok_r (str, ":", &saveptr);
>  	assert (str_len);
> @@ -96,14 +94,14 @@ static void ta_handle_command (int sock, char* msg)
>  		if (func == NULL) {
>  			/* first "arg" is the function */
>  			if (parse_debug)
> -				syslog (LOG_DEBUG, "(LEN:%s, FUNC:%s)", str_len, str_arg);
> +				qb_log (LOG_DEBUG, "(LEN:%s, FUNC:%s)", str_len, str_arg);
>  			func = str_arg;
>  			a = 0;
>  		} else {
>  			args[a] = str_arg;
>  			a++;
>  			if (parse_debug)
> -				syslog (LOG_DEBUG, "(LEN:%s, ARG:%s)", str_len, str_arg);
> +				qb_log (LOG_DEBUG, "(LEN:%s, ARG:%s)", str_len, str_arg);
>  		}
>  	}
>  	do_command (sock, func, args, a+1);
> @@ -121,7 +119,8 @@ static int server_process_data_fn (
>  	char *cmd;
>  	int32_t nbytes;
>  
> -	if (revents & POLLHUP) {
> +	if (revents & POLLHUP || revents & POLLERR) {
> +		qb_log (LOG_INFO, "command sockect got POLLHUP exiting...");
>  		shut_me_down();
>  		return -1;
>  	}
> @@ -130,9 +129,9 @@ static int server_process_data_fn (
>  		/* got error or connection closed by client */
>  		if (nbytes == 0) {
>  			/* connection closed */
> -			syslog (LOG_WARNING, "socket %d hung up: exiting...\n", fd);
> +			qb_log (LOG_WARNING, "socket %d hung up: exiting...\n", fd);
>  		} else {
> -			syslog (LOG_ERR,"recv() failed: %s", strerror(errno));
> +			qb_perror(LOG_ERR, "recv() failed");
>  		}
>  		shut_me_down();
>  		return -1;
> @@ -160,7 +159,8 @@ static int server_accept_fn (
>  	int new_fd;
>  	int res;
>  
> -	if (revents & POLLHUP) {
> +	if (revents & POLLHUP || revents & POLLERR) {
> +		qb_log (LOG_INFO, "command sockect got POLLHUP exiting...");
>  		shut_me_down();
>  		return -1;
>  	}
> @@ -174,14 +174,14 @@ retry_accept:
>  	}
>  
>  	if (new_fd == -1) {
> -		syslog (LOG_ERR,
> +		qb_log (LOG_ERR,
>  			"Could not accept connection: %s\n", strerror (errno));
>  		return (0); /* This is an error, but -1 would indicate disconnect from poll loop */
>  	}
>  
>  	res = fcntl (new_fd, F_SETFL, O_NONBLOCK);
>  	if (res == -1) {
> -		syslog (LOG_ERR,
> +		qb_log (LOG_ERR,
>  			"Could not set non-blocking operation on connection: %s\n",
>  			strerror (errno));
>  		close (new_fd);
> @@ -216,7 +216,7 @@ static int create_server_sockect (int server_port)
>  	hints.ai_socktype = SOCK_STREAM;
>  	hints.ai_flags = AI_PASSIVE;
>  	if ((rv = getaddrinfo (NULL, server_port_str, &hints, &ai)) != 0) {
> -		syslog (LOG_ERR, "%s", gai_strerror (rv));
> +		qb_log (LOG_ERR, "%s", gai_strerror (rv));
>  		exit (1);
>  	}
>  
> @@ -230,7 +230,7 @@ static int create_server_sockect (int server_port)
>  		 */
>  		if (setsockopt (listener, SOL_SOCKET, SO_REUSEADDR,
>  				&yes, sizeof(int)) < 0) {
> -			syslog (LOG_ERR, "setsockopt() failed: %s", strerror (errno));
> +			qb_log (LOG_ERR, "setsockopt() failed: %s", strerror (errno));
>  		}
>  
>  		switch (p->ai_family)
> @@ -242,17 +242,17 @@ static int create_server_sockect (int server_port)
>  			ptr = &((struct sockaddr_in6 *) p->ai_addr)->sin6_addr;
>  			break;
>  		default:
> -			syslog (LOG_ERR, "address family wrong");
> +			qb_log (LOG_ERR, "address family wrong");
>  			exit (4);
>  			
>  		}
>  
>  		if (inet_ntop(p->ai_family, ptr, addr_str, INET_ADDRSTRLEN) == NULL) {
> -			syslog (LOG_ERR, "inet_ntop() failed: %s", strerror (errno));
> +			qb_log (LOG_ERR, "inet_ntop() failed: %s", strerror (errno));
>  		}
>  
>  		if (bind (listener, p->ai_addr, p->ai_addrlen) < 0) {
> -			syslog (LOG_ERR, "bind(%s) failed: %s\n", addr_str, strerror (errno));
> +			qb_log (LOG_ERR, "bind(%s) failed: %s\n", addr_str, strerror (errno));
>  			close (listener);
>  			continue;
>  		}
> @@ -261,14 +261,14 @@ static int create_server_sockect (int server_port)
>  	}
>  
>  	if (p == NULL) {
> -		syslog (LOG_ERR, "failed to bind");
> +		qb_log (LOG_ERR, "failed to bind");
>  		exit (2);
>  	}
>  
>  	freeaddrinfo (ai);
>  
>  	if (listen (listener, 10) == -1) {
> -		syslog (LOG_ERR, "listen() failed: %s", strerror(errno));
> +		qb_log (LOG_ERR, "listen() failed: %s", strerror(errno));
>  		exit (3);
>  	}
>  
> @@ -277,14 +277,22 @@ static int create_server_sockect (int server_port)
>  
>  static int32_t sig_exit_handler (int num, void *data)
>  {
> +	qb_log (LOG_INFO, "got signal %d, exiting", num);
>  	shut_me_down();
>  	return 0;
>  }
>  
> -int test_agent_run(int server_port, ta_do_command_fn func, pre_exit_fn exit_fn)
> +int
> +test_agent_run(const char * prog_name, int server_port,
> +		ta_do_command_fn func, pre_exit_fn exit_fn)
>  {
>  	int listener;
>  
> +	qb_log_init(prog_name, LOG_DAEMON, LOG_DEBUG);
> +	qb_log_format_set(QB_LOG_SYSLOG, "%n() [%p] %b");
> +
> +	qb_log (LOG_INFO, "STARTING");
> +
>  	do_command = func;
>  	pre_exit = exit_fn;
>  	poll_handle = qb_loop_create ();
> @@ -306,6 +314,9 @@ int test_agent_run(int server_port, ta_do_command_fn func, pre_exit_fn exit_fn)
>  			  NULL, server_accept_fn);
>  
>  	qb_loop_run (poll_handle);
> +
> +	qb_log (LOG_INFO, "EXITING");
> +	qb_log_fini();
>  	return 0;
>  }
>  
> diff --git a/cts/agents/common_test_agent.h b/cts/agents/common_test_agent.h
> index 477f5c7..abd4009 100644
> --- a/cts/agents/common_test_agent.h
> +++ b/cts/agents/common_test_agent.h
> @@ -37,6 +37,7 @@
>  
>  #include <corosync/hdb.h>
>  #include <qb/qbloop.h>
> +#include <qb/qblog.h>
>  
>  #define OK_STR "OK"
>  #define FAIL_STR "FAIL"
> @@ -48,7 +49,8 @@ extern int32_t parse_debug;
>  typedef void (*ta_do_command_fn) (int sock, char* func, char*args[], int num_args);
>  typedef void (*pre_exit_fn) (void);
>  
> -int test_agent_run(int server_port, ta_do_command_fn func, pre_exit_fn exit_fn);
> +int test_agent_run(const char * prog_name, int server_port,
> +		   ta_do_command_fn func, pre_exit_fn exit_fn);
>  
>  qb_loop_t *ta_poll_handle_get(void);
>  
> diff --git a/cts/agents/cpg_test_agent.c b/cts/agents/cpg_test_agent.c
> index cd225b2..befeeea 100644
> --- a/cts/agents/cpg_test_agent.c
> +++ b/cts/agents/cpg_test_agent.c
> @@ -773,20 +773,12 @@ static void my_pre_exit(void)
>  	}
>  }
>  
> -int main (int argc, char *argv[])
> +int
> +main(int argc, char *argv[])
>  {
> -	int res = 0;
> -
> -	qb_log_init("cpg_test_agent", LOG_DAEMON, LOG_DEBUG);
> -	qb_log_format_set(QB_LOG_SYSLOG, "%n() [%p] %b");
> -	qb_log (LOG_INFO, "STARTING");
> -
>  	list_init (&msg_log_head);
>  	list_init (&config_chg_log_head);
>  
> -	res = test_agent_run (9034, do_command, my_pre_exit);
> -	qb_log (LOG_INFO, "EXITING");
> -	qb_log_fini();
> -	return res;
> +	return test_agent_run ("cpg_test_agent", 9034, do_command, my_pre_exit);
>  }
>  
> diff --git a/cts/agents/sam_test_agent.c b/cts/agents/sam_test_agent.c
> index 3ac366b..034c47e 100644
> --- a/cts/agents/sam_test_agent.c
> +++ b/cts/agents/sam_test_agent.c
> @@ -54,7 +54,6 @@
>  #include <corosync/sam.h>
>  #include <signal.h>
>  #include <string.h>
> -#include <syslog.h>
>  #include <sys/wait.h>
>  #include <corosync/cmap.h>
>  
> @@ -82,60 +81,60 @@ static int test1 (void)
>  	unsigned int instance_id;
>  	int i;
>  
> -	syslog (LOG_INFO, "%s: initialize\n", __FUNCTION__);
> +	qb_enter();
>  	error = sam_initialize (2000, SAM_RECOVERY_POLICY_RESTART);
>  	if (error != CS_OK) {
> -		syslog (LOG_ERR, "Can't initialize SAM API. Error %d\n", error);
> +		qb_log (LOG_ERR, "Can't initialize SAM API. Error %d\n", error);
>  		return 1;
>  	}
> -	syslog (LOG_INFO, "%s: register\n", __FUNCTION__);
> +	qb_log (LOG_INFO, "register");
>  	error = sam_register (&instance_id);
>  	if (error != CS_OK) {
> -		syslog (LOG_ERR, "Can't register. Error %d\n", error);
> +		qb_log (LOG_ERR, "Can't register. Error %d\n", error);
>  		return 1;
>  	}
>  
>  	if (instance_id == 1 || instance_id == 2) {
> -		syslog (LOG_INFO, "%s iid %d: start\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "iid %d: start", instance_id);
>  		error = sam_start ();
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't start hc. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't start hc. Error %d", error);
>  			return 1;
>  		}
>  
>  		for (i = 0; i < 10; i++) {
> -			syslog (LOG_INFO, "%s iid %d: sleep 1\n", __FUNCTION__, instance_id);
> +			qb_log (LOG_INFO, "iid %d: sleep 1", instance_id);
>  			sleep (1);
>  
> -			syslog (LOG_INFO, "%s iid %d: hc send\n", __FUNCTION__, instance_id);
> +			qb_log (LOG_INFO, "iid %d: hc send", instance_id);
>  			error = sam_hc_send ();
>  			if (error != CS_OK) {
> -				syslog (LOG_ERR, "Can't send hc. Error %d\n", error);
> +				qb_log (LOG_ERR, "Can't send hc. Error %d", error);
>  				return 1;
>  			}
>  		}
>  
>  		if (instance_id == 2) {
> -			syslog (LOG_INFO, "%s iid %d: stop\n", __FUNCTION__, instance_id);
> +			qb_log (LOG_INFO, "iid %d: stop", instance_id);
>  			error = sam_stop ();
>  
>  			if (error != CS_OK) {
> -				syslog (LOG_ERR, "Can't send hc. Error %d\n", error);
> +				qb_log (LOG_ERR, "Can't send hc. Error %d", error);
>  				return 1;
>  			}
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: sleep 3\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "iid %d: sleep 3", instance_id);
>  		sleep (3);
>  
> -		syslog (LOG_INFO, "%s iid %d: start\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "iid %d: start", instance_id);
>  		error = sam_start ();
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't start hc. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't start hc. Error %d", error);
>  			return 1;
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: sleep 3\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "iid %d: sleep 3", instance_id);
>  		sleep (3);
>  		return 0;
>  	}
> @@ -143,28 +142,28 @@ static int test1 (void)
>  	if (instance_id == 3) {
>  		error = sam_initialize (2000, SAM_RECOVERY_POLICY_RESTART);
>  		if (error == CS_OK) {
> -			syslog (LOG_ERR, "Can initialize SAM API after initialization");
> +			qb_log (LOG_ERR, "Can initialize SAM API after initialization");
>  			return 1;
>  		}
>  
>  		error = sam_start ();
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't start hc. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't start hc. Error %d", error);
>  			return 1;
>  		}
>  		error = sam_stop ();
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't stop hc. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't stop hc. Error %d", error);
>  			return 1;
>  		}
>  		error = sam_finalize ();
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't finalize sam. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't finalize sam. Error %d", error);
>  			return 1;
>  		}
>  		error = sam_finalize ();
>  		if (error == CS_OK) {
> -			syslog (LOG_ERR, "Can finalize sam after finalization!\n");
> +			qb_log (LOG_ERR, "Can finalize sam after finalization!");
>  			return 1;
>  		}
>  
> @@ -173,7 +172,7 @@ static int test1 (void)
>  			sam_register (NULL) == CS_OK || sam_hc_send () == CS_OK ||
>  			sam_hc_callback_register (NULL) == CS_OK) {
>  
> -			syslog (LOG_ERR, "Can call one of function after finalization!\n");
> +			qb_log (LOG_ERR, "Can call one of function after finalization!");
>  
>  			return 1;
>  		}
> @@ -185,8 +184,9 @@ static int test1 (void)
>  }
>  
>  
> -static void test2_signal (int sig) {
> -	syslog (LOG_INFO, "%s\n", __FUNCTION__);
> +static void test2_signal (int sig)
> +{
> +	qb_enter();
>  
>  	test2_sig_delivered = 1;
>  }
> @@ -198,46 +198,46 @@ static int test2 (void) {
>  	cs_error_t error;
>  	unsigned int instance_id;
>  
> -	syslog (LOG_INFO, "%s: initialize\n", __FUNCTION__);
> +	qb_enter();
>  	error = sam_initialize (2000, SAM_RECOVERY_POLICY_QUIT);
>  	if (error != CS_OK) {
> -		syslog (LOG_ERR, "Can't initialize SAM API. Error %d\n", error);
> +		qb_log (LOG_ERR, "Can't initialize SAM API. Error %d", error);
>  		return 1;
>  	}
> -	syslog (LOG_INFO, "%s: register\n", __FUNCTION__);
> +	qb_log (LOG_INFO, "register");
>  	error = sam_register (&instance_id);
>  	if (error != CS_OK) {
> -		syslog (LOG_ERR, "Can't register. Error %d\n", error);
> +		qb_log (LOG_ERR, "Can't register. Error %d", error);
>  		return 1;
>  	}
>  
>  	if (instance_id == 1) {
>  		signal (SIGTERM, test2_signal);
>  
> -		syslog (LOG_INFO, "%s iid %d: start\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "iid %d: start", instance_id);
>  		error = sam_start ();
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't start hc. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't start hc. Error %d", error);
>  			return 1;
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: sleep 1\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "iid %d: sleep 1", instance_id);
>  		sleep (1);
>  
> -		syslog (LOG_INFO, "%s iid %d: hc send\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "iid %d: hc send", instance_id);
>  		error = sam_hc_send ();
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't send hc. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't send hc. Error %d", error);
>  			return 1;
>  		}
>  
>  
> -		syslog (LOG_INFO, "%s iid %d: wait for delivery of signal\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "iid %d: wait for delivery of signal", instance_id);
>  		while (!test2_sig_delivered) {
>  			sleep (1);
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: wait for real kill\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "iid %d: wait for real kill", instance_id);
>  
>  		sleep (3);
>  	}
> @@ -254,28 +254,28 @@ static int test3 (void) {
>  	cs_error_t error;
>  	unsigned int instance_id;
>  
> -	syslog (LOG_INFO, "%s: initialize\n", __FUNCTION__);
> +	qb_log (LOG_INFO, "initialize");
>  	error = sam_initialize (0, SAM_RECOVERY_POLICY_RESTART);
>  	if (error != CS_OK) {
> -		syslog (LOG_ERR, "Can't initialize SAM API. Error %d\n", error);
> +		qb_log (LOG_ERR, "Can't initialize SAM API. Error %d", error);
>  		return 1;
>  	}
> -	syslog (LOG_INFO, "%s: register\n", __FUNCTION__);
> +	qb_log (LOG_INFO, "register");
>  	error = sam_register (&instance_id);
>  	if (error != CS_OK) {
> -		syslog (LOG_ERR, "Can't register. Error %d\n", error);
> +		qb_log (LOG_ERR, "Can't register. Error %d", error);
>  		return 1;
>  	}
>  
>  	if (instance_id < 100) {
> -		syslog (LOG_INFO, "%s iid %d: start\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "iid %d: start", instance_id);
>  		error = sam_start ();
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't start hc. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't start hc. Error %d", error);
>  			return 1;
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: Sending signal\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "iid %d: Sending signal", instance_id);
>  		kill(getpid(), SIGSEGV);
>  		return 1;
>  	}
> @@ -296,56 +296,56 @@ static int test4 (void)
>  	char saved_data[128];
>  	char saved_data2[128];
>  
> -	syslog (LOG_INFO, "%s: sam_data_getsize 1\n", __FUNCTION__);
> +	qb_log (LOG_INFO, "sam_data_getsize 1");
>  	err = sam_data_getsize (&size);
>  	if (err != CS_ERR_BAD_HANDLE) {
> -		syslog (LOG_ERR, "Test should return CS_ERR_BAD_HANDLE. Error returned %d\n", err);
> +		qb_log (LOG_ERR, "Test should return CS_ERR_BAD_HANDLE. Error returned %d", err);
>  		return 1;
>  	}
>  
> -	syslog (LOG_INFO, "%s: sam_data_getsize 2\n", __FUNCTION__);
> +	qb_log (LOG_INFO, "sam_data_getsize 2");
>  	err = sam_data_getsize (NULL);
>  	if (err != CS_ERR_INVALID_PARAM) {
> -		syslog (LOG_ERR, "Test should return CS_ERR_INVALID_PARAM. Error returned %d\n", err);
> +		qb_log (LOG_ERR, "Test should return CS_ERR_INVALID_PARAM. Error returned %d", err);
>  		return 1;
>  	}
>  
> -	syslog (LOG_INFO, "%s: sam_data_store 1\n", __FUNCTION__);
> +	qb_log (LOG_INFO, "sam_data_store 1");
>  	err = sam_data_store (NULL, 0);
>  	if (err != CS_ERR_BAD_HANDLE) {
> -		syslog (LOG_ERR, "Test should return CS_ERR_BAD_HANDLE. Error returned %d\n", err);
> +		qb_log (LOG_ERR, "Test should return CS_ERR_BAD_HANDLE. Error returned %d", err);
>  		return 1;
>  	}
>  
> -	syslog (LOG_INFO, "%s: sam_data_restore 1\n", __FUNCTION__);
> +	qb_log (LOG_INFO, "sam_data_restore 1");
>  	err = sam_data_restore (saved_data, sizeof (saved_data));
>  	if (err != CS_ERR_BAD_HANDLE) {
> -		syslog (LOG_ERR, "Test should return CS_ERR_BAD_HANDLE. Error returned %d\n", err);
> +		qb_log (LOG_ERR, "Test should return CS_ERR_BAD_HANDLE. Error returned %d", err);
>  		return 1;
>  	}
>  
> -	syslog (LOG_INFO, "%s: sam_initialize\n", __FUNCTION__);
> +	qb_log (LOG_INFO, "sam_initialize");
>  	err = sam_initialize (0, SAM_RECOVERY_POLICY_RESTART);
>  	if (err != CS_OK) {
> -		syslog (LOG_ERR, "Can't initialize SAM API. Error %d\n", err);
> +		qb_log (LOG_ERR, "Can't initialize SAM API. Error %d", err);
>  		return 1;
>  	}
>  
> -	syslog (LOG_INFO, "%s: sam_data_getsize 3\n", __FUNCTION__);
> +	qb_log (LOG_INFO, "sam_data_getsize 3");
>  	err = sam_data_getsize (&size);
>  	if (err != CS_OK) {
> -		syslog (LOG_ERR, "Test should return CS_ERR_BAD_HANDLE. Error returned %d\n", err);
> +		qb_log (LOG_ERR, "Test should return CS_ERR_BAD_HANDLE. Error returned %d", err);
>  		return 1;
>  	}
>  	if (size != 0) {
> -		syslog (LOG_ERR, "Test should return size of 0. Returned %zx\n", size);
> +		qb_log (LOG_ERR, "Test should return size of 0. Returned %zx", size);
>  		return 1;
>  	}
>  
> -	syslog (LOG_INFO, "%s: sam_data_restore 2\n", __FUNCTION__);
> +	qb_log (LOG_INFO, "sam_data_restore 2");
>  	err = sam_data_restore (NULL, sizeof (saved_data));
>  	if (err != CS_ERR_INVALID_PARAM) {
> -		syslog (LOG_ERR, "Test should return CS_ERR_INVALID_PARAM. Error returned %d\n", err);
> +		qb_log (LOG_ERR, "Test should return CS_ERR_INVALID_PARAM. Error returned %d", err);
>  		return 1;
>  	}
>  
> @@ -356,105 +356,105 @@ static int test4 (void)
>  		saved_data[i] = (char)(i + 5);
>  	}
>  
> -	syslog (LOG_INFO, "%s: sam_data_store 2\n", __FUNCTION__);
> +	qb_log (LOG_INFO, "sam_data_store 2");
>  	err = sam_data_store (saved_data, sizeof (saved_data));
>  	if (err != CS_OK) {
> -		syslog (LOG_ERR, "Test should return CS_OK. Error returned %d\n", err);
> +		qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err);
>  		return 1;
>  	}
>  
> -	syslog (LOG_INFO, "%s: sam_data_getsize 4\n", __FUNCTION__);
> +	qb_log (LOG_INFO, " sam_data_getsize 4");
>  	err = sam_data_getsize (&size);
>  	if (err != CS_OK) {
> -		syslog (LOG_ERR, "Test should return CS_OK. Error returned %d\n", err);
> +		qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err);
>  		return 1;
>  	}
>  	if (size != sizeof (saved_data)) {
> -		syslog (LOG_ERR, "Test should return size of 0. Returned %zx\n", size);
> +		qb_log (LOG_ERR, "Test should return size of 0. Returned %zx", size);
>  		return 1;
>  	}
>  
> -	syslog (LOG_INFO, "%s: sam_data_restore 3\n", __FUNCTION__);
> +	qb_log (LOG_INFO, " sam_data_restore 3");
>  	err = sam_data_restore (saved_data2, sizeof (saved_data2) - 1);
>  	if (err != CS_ERR_INVALID_PARAM) {
> -		syslog (LOG_ERR, "Test should return CS_ERR_INVALID_PARAM. Error returned %d\n", err);
> +		qb_log (LOG_ERR, "Test should return CS_ERR_INVALID_PARAM. Error returned %d", err);
>  		return 1;
>  	}
>  
> -	syslog (LOG_INFO, "%s: sam_data_restore 4\n", __FUNCTION__);
> +	qb_log (LOG_INFO, " sam_data_restore 4");
>  	err = sam_data_restore (saved_data2, sizeof (saved_data2));
>  	if (err != CS_OK) {
> -		syslog (LOG_ERR, "Test should return CS_OK. Error returned %d\n", err);
> +		qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err);
>  		return 1;
>  	}
>  
>  	if (memcmp (saved_data, saved_data2, sizeof (saved_data2)) != 0) {
> -		syslog (LOG_ERR, "Retored data are not same\n");
> +		qb_log (LOG_ERR, "Retored data are not same");
>  		return 1;
>  	}
>  
>  	memset (saved_data2, 0, sizeof (saved_data2));
>  
> -	syslog (LOG_INFO, "%s: sam_data_store 3\n", __FUNCTION__);
> +	qb_log (LOG_INFO, " sam_data_store 3");
>  	err = sam_data_store (NULL, 1);
>  	if (err != CS_OK) {
> -		syslog (LOG_ERR, "Test should return CS_OK. Error returned %d\n", err);
> +		qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err);
>  		return 1;
>  	}
>  
> -	syslog (LOG_INFO, "%s: sam_data_getsize 5\n", __FUNCTION__);
> +	qb_log (LOG_INFO, " sam_data_getsize 5");
>  	err = sam_data_getsize (&size);
>  	if (err != CS_OK) {
> -		syslog (LOG_ERR, "Test should return CS_OK. Error returned %d\n", err);
> +		qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err);
>  		return 1;
>  	}
>  	if (size != 0) {
> -		syslog (LOG_ERR, "Test should return size of 0. Returned %zx\n", size);
> +		qb_log (LOG_ERR, "Test should return size of 0. Returned %zx", size);
>  		return 1;
>  	}
>  
> -	syslog (LOG_INFO, "%s: sam_data_store 4\n", __FUNCTION__);
> +	qb_log (LOG_INFO, " sam_data_store 4");
>  	err = sam_data_store (saved_data, sizeof (saved_data));
>  	if (err != CS_OK) {
> -		syslog (LOG_ERR, "Test should return CS_OK. Error returned %d\n", err);
> +		qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err);
>  		return 1;
>  	}
>  
> -	syslog (LOG_INFO, "%s: register\n", __FUNCTION__);
> +	qb_log (LOG_INFO, " register");
>  	err = sam_register (&instance_id);
>  	if (err != CS_OK) {
> -		syslog (LOG_ERR, "Can't register. Error %d\n", err);
> +		qb_log (LOG_ERR, "Can't register. Error %d", err);
>  		return 1;
>  	}
>  
>  	if (instance_id == 1) {
> -		syslog (LOG_INFO, "%s iid %d: sam_start\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: sam_start", instance_id);
>  		err = sam_start ();
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Can't start hc. Error %d\n", err);
> +			qb_log (LOG_ERR, "Can't start hc. Error %d", err);
>  			return 1;
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: sam_data_getsize 6\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: sam_data_getsize 6", instance_id);
>  		err = sam_data_getsize (&size);
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Test should return CS_OK. Error returned %d\n", err);
> +			qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err);
>  			return 1;
>  		}
>  		if (size != sizeof (saved_data2)) {
> -			syslog (LOG_ERR, "Test should return size of 0. Returned %zx\n", size);
> +			qb_log (LOG_ERR, "Test should return size of 0. Returned %zx", size);
>  			return 1;
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: sam_data_restore 5\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: sam_data_restore 5", instance_id);
>  		err = sam_data_restore (saved_data2, sizeof (saved_data2));
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Test should return CS_OK. Error returned %d\n", err);
> +			qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err);
>  			return 1;
>  		}
>  
>  		if (memcmp (saved_data, saved_data2, sizeof (saved_data2)) != 0) {
> -			syslog (LOG_ERR, "Retored data are not same\n");
> +			qb_log (LOG_ERR, "Retored data are not same");
>  			return 1;
>  		}
>  
> @@ -462,10 +462,10 @@ static int test4 (void)
>  			saved_data[i] = (char)(i - 5);
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: sam_data_store 5\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: sam_data_store 5", instance_id);
>  		err = sam_data_store (saved_data, sizeof (saved_data) - 7);
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Test should return CS_OK. Error returned %d\n", err);
> +			qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err);
>  			return 1;
>  		}
>  
> @@ -473,28 +473,28 @@ static int test4 (void)
>  	}
>  
>  	if (instance_id == 2) {
> -		syslog (LOG_INFO, "%s iid %d: sam_start\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: sam_start", instance_id);
>  		err = sam_start ();
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Can't start hc. Error %d\n", err);
> +			qb_log (LOG_ERR, "Can't start hc. Error %d", err);
>  			return 1;
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: sam_data_getsize 7\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: sam_data_getsize 7", instance_id);
>  		err = sam_data_getsize (&size);
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Test should return CS_OK. Error returned %d\n", err);
> +			qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err);
>  			return 1;
>  		}
>  		if (size != sizeof (saved_data2) - 7) {
> -			syslog (LOG_ERR, "Test should return size of 0. Returned %zx\n", size);
> +			qb_log (LOG_ERR, "Test should return size of 0. Returned %zx", size);
>  			return 1;
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: sam_data_restore 6\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: sam_data_restore 6", instance_id);
>  		err = sam_data_restore (saved_data2, sizeof (saved_data2));
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Test should return CS_OK. Error returned %d\n", err);
> +			qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err);
>  			return 1;
>  		}
>  
> @@ -503,14 +503,14 @@ static int test4 (void)
>  		}
>  
>  		if (memcmp (saved_data, saved_data2, sizeof (saved_data2) - 7) != 0) {
> -			syslog (LOG_ERR, "Retored data are not same\n");
> +			qb_log (LOG_ERR, "Retored data are not same");
>  			return 1;
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: sam_data_store 6\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: sam_data_store 6", instance_id);
>  		err = sam_data_store (NULL, 0);
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Test should return CS_OK. Error returned %d\n", err);
> +			qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err);
>  			return 1;
>  		}
>  
> @@ -518,14 +518,14 @@ static int test4 (void)
>  	}
>  
>  	if (instance_id == 3) {
> -		syslog (LOG_INFO, "%s iid %d: sam_data_getsize 8\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: sam_data_getsize 8", instance_id);
>  		err = sam_data_getsize (&size);
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Test should return CS_OK. Error returned %d\n", err);
> +			qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err);
>  			return 1;
>  		}
>  		if (size != 0) {
> -			syslog (LOG_ERR, "Test should return size of 0. Returned %zx\n", size);
> +			qb_log (LOG_ERR, "Test should return size of 0. Returned %zx", size);
>  			return 1;
>  		}
>  	}
> @@ -537,7 +537,7 @@ static int test5_hc_cb (void)
>  {
>  	cs_error_t res;
>  
> -	syslog (LOG_INFO, "%s %d\n", __FUNCTION__, ++test5_hc_cb_count);
> +	qb_log (LOG_INFO, "%s %d", ++test5_hc_cb_count);
>  
>  	res = sam_data_store (&test5_hc_cb_count, sizeof (test5_hc_cb_count));
>  
> @@ -558,50 +558,50 @@ static int test5 (void)
>  	unsigned int instance_id;
>  	int hc_cb_count;
>  
> -	syslog (LOG_INFO, "%s: initialize\n", __FUNCTION__);
> +	qb_log (LOG_INFO, " initialize");
>  	error = sam_initialize (100, SAM_RECOVERY_POLICY_RESTART);
>  	if (error != CS_OK) {
> -		syslog (LOG_ERR, "Can't initialize SAM API. Error %d\n", error);
> +		qb_log (LOG_ERR, "Can't initialize SAM API. Error %d", error);
>  		return 1;
>  	}
> -	syslog (LOG_INFO, "%s: register\n", __FUNCTION__);
> +	qb_log (LOG_INFO, " register");
>  	error = sam_register (&instance_id);
>  	if (error != CS_OK) {
> -		syslog (LOG_ERR, "Can't register. Error %d\n", error);
> +		qb_log (LOG_ERR, "Can't register. Error %d", error);
>  		return 1;
>  	}
>  
>  	if (instance_id == 1) {
> -		syslog (LOG_INFO, "%s iid %d: hc callback register\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: hc callback register", instance_id);
>  		error = sam_hc_callback_register (test5_hc_cb);
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't register hc cb. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't register hc cb. Error %d", error);
>  			return 1;
>  		}
>  
>  
> -		syslog (LOG_INFO, "%s iid %d: start\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: start", instance_id);
>  		error = sam_start ();
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't start hc. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't start hc. Error %d", error);
>  			return 1;
>  		}
>  
>  		sleep (2);
>  
> -		syslog (LOG_INFO, "%s iid %d: Failed. Wasn't killed.\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: Failed. Wasn't killed.", instance_id);
>  		return 1;
>  	}
>  
>  	if (instance_id == 2) {
>  		error = sam_data_restore (&hc_cb_count, sizeof (hc_cb_count));
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "sam_data_restore should return CS_OK. Error returned %d\n", error);
> +			qb_log (LOG_ERR, "sam_data_restore should return CS_OK. Error returned %d", error);
>  			return 1;
>  		}
>  
>  		if (hc_cb_count != 11) {
> -			syslog (LOG_ERR, "%s iid %d: Premature killed. hc_cb_count should be 11 and it is %d\n",
> +			qb_log (LOG_ERR, "%s iid %d: Premature killed. hc_cb_count should be 11 and it is %d",
>  				__FUNCTION__, instance_id - 1, hc_cb_count);
>  			return 1;
>  
> @@ -615,11 +615,11 @@ static int test5 (void)
>  static void test6_signal (int sig) {
>  	cs_error_t error;
>  
> -	syslog (LOG_INFO, "%s\n", __FUNCTION__);
> +	qb_log (LOG_INFO, "%s");
>  	test6_sig_delivered++;
>  
>  	if ((error = sam_data_store (&test6_sig_delivered, sizeof (test6_sig_delivered))) != CS_OK) {
> -		syslog (LOG_ERR, "Can't store data! Error : %d\n", error);
> +		qb_log (LOG_ERR, "Can't store data! Error : %d", error);
>  	}
>  }
>  
> @@ -631,115 +631,115 @@ static int test6 (void) {
>  	unsigned int instance_id;
>  	int test6_sig_del;
>  
> -	syslog (LOG_INFO, "%s: initialize\n", __FUNCTION__);
> +	qb_log (LOG_INFO, " initialize");
>  	error = sam_initialize (2000, SAM_RECOVERY_POLICY_RESTART);
>  	if (error != CS_OK) {
> -		syslog (LOG_ERR, "Can't initialize SAM API. Error %d\n", error);
> +		qb_log (LOG_ERR, "Can't initialize SAM API. Error %d", error);
>  		return 1;
>  	}
> -	syslog (LOG_INFO, "%s: register\n", __FUNCTION__);
> +	qb_log (LOG_INFO, " register");
>  	error = sam_register (&instance_id);
>  	if (error != CS_OK) {
> -		syslog (LOG_ERR, "Can't register. Error %d\n", error);
> +		qb_log (LOG_ERR, "Can't register. Error %d", error);
>  		return 1;
>  	}
>  
>  	if (instance_id == 1) {
>  		error = sam_warn_signal_set (SIGUSR1);
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't set warn signal. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't set warn signal. Error %d", error);
>  			return 1;
>  		}
>  
>  		signal (SIGUSR1, test6_signal);
>  
> -		syslog (LOG_INFO, "%s iid %d: start\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: start", instance_id);
>  		error = sam_start ();
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't start hc. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't start hc. Error %d", error);
>  			return 1;
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: sleep 1\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: sleep 1", instance_id);
>  		sleep (1);
>  
> -		syslog (LOG_INFO, "%s iid %d: hc send\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: hc send", instance_id);
>  		error = sam_hc_send ();
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't send hc. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't send hc. Error %d", error);
>  			return 1;
>  		}
>  
>  
> -		syslog (LOG_INFO, "%s iid %d: wait for delivery of signal\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: wait for delivery of signal", instance_id);
>  		while (!test6_sig_delivered) {
>  			sleep (1);
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: wait for real kill\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: wait for real kill", instance_id);
>  
>  		sleep (3);
>  
> -		syslog (LOG_INFO, "%s iid %d: wasn't killed\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: wasn't killed", instance_id);
>  		return (1);
>  	}
>  
>  	if (instance_id == 2) {
>  		error = sam_data_restore (&test6_sig_del, sizeof (test6_sig_del));
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't restore data. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't restore data. Error %d", error);
>  			return 1;
>  		}
>  
>  		if (test6_sig_del != 1) {
> -			syslog (LOG_ERR, "Previous test failed. Signal was not delivered\n");
> +			qb_log (LOG_ERR, "Previous test failed. Signal was not delivered");
>  			return 1;
>  		}
>  
>  		error = sam_warn_signal_set (SIGKILL);
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't set warn signal. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't set warn signal. Error %d", error);
>  			return 1;
>  		}
>  
>  		signal (SIGUSR1, test6_signal);
>  
> -		syslog (LOG_INFO, "%s iid %d: start\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: start", instance_id);
>  		error = sam_start ();
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't start hc. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't start hc. Error %d", error);
>  			return 1;
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: sleep 1\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: sleep 1", instance_id);
>  		sleep (1);
>  
> -		syslog (LOG_INFO, "%s iid %d: hc send\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: hc send", instance_id);
>  		error = sam_hc_send ();
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't send hc. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't send hc. Error %d", error);
>  			return 1;
>  		}
>  
>  
> -		syslog (LOG_INFO, "%s iid %d: wait for delivery of signal\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: wait for delivery of signal", instance_id);
>  		while (!test6_sig_delivered) {
>  			sleep (1);
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: wasn't killed\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: wasn't killed", instance_id);
>  		return (1);
>  	}
>  
>  	if (instance_id == 3) {
>  		error = sam_data_restore (&test6_sig_del, sizeof (test6_sig_del));
>  		if (error != CS_OK) {
> -			syslog (LOG_ERR, "Can't restore data. Error %d\n", error);
> +			qb_log (LOG_ERR, "Can't restore data. Error %d", error);
>  			return 1;
>  		}
>  
>  		if (test6_sig_del != 1) {
> -			syslog (LOG_ERR, "Previous test failed. Signal WAS delivered\n");
> +			qb_log (LOG_ERR, "Previous test failed. Signal WAS delivered");
>  			return 1;
>  		}
>  
> @@ -768,17 +768,17 @@ static int test_quorum (void) {
>  
>  	err = cmap_initialize (&cmap_handle);
>  	if (err != CS_OK) {
> -		syslog (LOG_INFO, "Could not initialize Cluster Map API instance error %d. Test skipped\n", err);
> +		qb_log (LOG_INFO, "Could not initialize Cluster Map API instance error %d. Test skipped", err);
>  		return (1);
>  	}
>  
>  
>  	if (cmap_get_string(cmap_handle, "quorum.provider", &str) != CS_OK) {
> -		syslog (LOG_INFO, "Could not get \"provider\" key: %d. Test skipped\n", err);
> +		qb_log (LOG_INFO, "Could not get \"provider\" key: %d. Test skipped", err);
>  		return (1);
>  	}
>          if (strcmp(str, "testquorum") != 0) {
> -		syslog (LOG_INFO, "Provider is not testquorum. Test skipped\n");
> +		qb_log (LOG_INFO, "Provider is not testquorum. Test skipped");
>  		return (1);
>          }
>  	free(str);
> @@ -788,21 +788,21 @@ static int test_quorum (void) {
>  	 */
>  	err = cmap_set_uint8(cmap_handle, "quorum.quorate", 0);
>  	if (err != CS_OK) {
> -		syslog (LOG_INFO, "Can't set map key. Error %d\n", err);
> +		qb_log (LOG_INFO, "Can't set map key. Error %d", err);
>  		return (2);
>  	}
>  
> -	syslog (LOG_INFO, "%s: initialize\n", __FUNCTION__);
> +	qb_log (LOG_INFO, " initialize");
>  	err = sam_initialize (2000, SAM_RECOVERY_POLICY_QUORUM_RESTART);
>  	if (err != CS_OK) {
> -		syslog (LOG_ERR, "Can't initialize SAM API. Error %d\n", err);
> +		qb_log (LOG_ERR, "Can't initialize SAM API. Error %d", err);
>  		return 2;
>  	}
>  
> -	syslog (LOG_INFO, "%s: register\n", __FUNCTION__);
> +	qb_log (LOG_INFO, " register");
>  	err = sam_register (&instance_id);
>  	if (err != CS_OK) {
> -		syslog (LOG_ERR, "Can't register. Error %d\n", err);
> +		qb_log (LOG_ERR, "Can't register. Error %d", err);
>  		return 2;
>  	}
>  
> @@ -812,14 +812,14 @@ static int test_quorum (void) {
>  		 */
>  		pthread_create (&kill_thread, NULL, test7_thread, NULL);
>  
> -		syslog (LOG_INFO, "%s iid %d: start - should block forever (waiting 5s)\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: start - should block forever (waiting 5s)", instance_id);
>  		err = sam_start ();
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Can't start hc. Error %d\n", err);
> +			qb_log (LOG_ERR, "Can't start hc. Error %d", err);
>  			return 2;
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: wasn't killed\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: wasn't killed", instance_id);
>  		return (2);
>  	}
>  
> @@ -829,14 +829,14 @@ static int test_quorum (void) {
>  		 */
>  		err = cmap_set_uint8(cmap_handle, "quorum.quorate", 1);
>  		if (err != CS_OK) {
> -			syslog (LOG_INFO, "Can't set map key. Error %d\n", err);
> +			qb_log (LOG_INFO, "Can't set map key. Error %d", err);
>  			return (2);
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: start\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: start", instance_id);
>  		err = sam_start ();
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Can't start hc. Error %d\n", err);
> +			qb_log (LOG_ERR, "Can't start hc. Error %d", err);
>  			return 2;
>  		}
>  
> @@ -845,14 +845,14 @@ static int test_quorum (void) {
>  		 */
>  		err = cmap_set_uint8(cmap_handle, "quorum.quorate", 0);
>  		if (err != CS_OK) {
> -			syslog (LOG_INFO, "Can't set map key. Error %d\n", err);
> +			qb_log (LOG_INFO, "Can't set map key. Error %d", err);
>  			return (2);
>  		}
>  
> -		syslog (LOG_INFO, "%s iid %d: sleep 3\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: sleep 3", instance_id);
>  		sleep (3);
>  
> -		syslog (LOG_INFO, "%s iid %d: wasn't killed\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: wasn't killed", instance_id);
>  		return (2);
>  	}
>  
> @@ -877,51 +877,51 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
>  
>  	err = cmap_initialize (&cmap_handle);
>  	if (err != CS_OK) {
> -		syslog (LOG_INFO, "Could not initialize Cluster Map API instance error %d. Test skipped\n", err);
> +		qb_log (LOG_INFO, "Could not initialize Cluster Map API instance error %d. Test skipped", err);
>  		return (1);
>  	}
>  
> -	syslog (LOG_INFO, "%s test %d\n", __FUNCTION__, test_n);
> +	qb_log (LOG_INFO, "%s test %d", test_n);
>  
>  	if (test_n == 2) {
>  		/*
>  		 * Object should not exist
>  		 */
> -		syslog (LOG_INFO, "%s Testing if object exists (it shouldn't)\n", __FUNCTION__);
> +		qb_log (LOG_INFO, "%s Testing if object exists (it shouldn't)");
>  
>  		snprintf(key_name, CMAP_KEYNAME_MAXLEN, "resources.process.%d.state", pid);
>  		err = cmap_get_string(cmap_handle, key_name, &str);
>  		if (err == CS_OK) {
> -			syslog (LOG_INFO, "Could find key \"%s\": %d.\n", key_name, err);
> +			qb_log (LOG_INFO, "Could find key \"%s\": %d.", key_name, err);
>  			free(str);
>  			return (2);
>  		}
>  	}
>  
>  	if (test_n == 1 || test_n == 2) {
> -		syslog (LOG_INFO, "%s: initialize\n", __FUNCTION__);
> +		qb_log (LOG_INFO, " initialize");
>  		err = sam_initialize (2000, SAM_RECOVERY_POLICY_QUIT | SAM_RECOVERY_POLICY_CMAP);
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Can't initialize SAM API. Error %d\n", err);
> +			qb_log (LOG_ERR, "Can't initialize SAM API. Error %d", err);
>  			return 2;
>  		}
>  
> -		syslog (LOG_INFO, "%s: register\n", __FUNCTION__);
> +		qb_log (LOG_INFO, " register");
>  		err = sam_register (&instance_id);
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Can't register. Error %d\n", err);
> +			qb_log (LOG_ERR, "Can't register. Error %d", err);
>  			return 2;
>  		}
>  
>  		snprintf(key_name, CMAP_KEYNAME_MAXLEN, "resources.process.%d.recovery", pid);
>  		err = cmap_get_string(cmap_handle, key_name, &str);
>  		if (err != CS_OK) {
> -			syslog (LOG_INFO, "Could not get \"recovery\" key: %d.\n", err);
> +			qb_log (LOG_INFO, "Could not get \"recovery\" key: %d.", err);
>  			return (2);
>  		}
>  
>  		if (strcmp(str, "quit") != 0) {
> -			syslog (LOG_INFO, "Recovery key \"%s\" is not \"quit\".\n", key_name);
> +			qb_log (LOG_INFO, "Recovery key \"%s\" is not \"quit\".", key_name);
>  			return (2);
>  		}
>  		free(str);
> @@ -929,154 +929,154 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
>  		snprintf(key_name, CMAP_KEYNAME_MAXLEN, "resources.process.%d.state", pid);
>  		err = cmap_get_string(cmap_handle, key_name, &str);
>  		if (err != CS_OK) {
> -			syslog (LOG_INFO, "Could not get \"state\" key: %d.\n", err);
> +			qb_log (LOG_INFO, "Could not get \"state\" key: %d.", err);
>  			return (2);
>  		}
>  
>  		if (strcmp(str, "stopped") != 0) {
> -			syslog (LOG_INFO, "State key is not \"stopped\".\n");
> +			qb_log (LOG_INFO, "State key is not \"stopped\".");
>  			return (2);
>  		}
>  		free(str);
>  
> -		syslog (LOG_INFO, "%s iid %d: start\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: start", instance_id);
>  		err = sam_start ();
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Can't start hc. Error %d\n", err);
> +			qb_log (LOG_ERR, "Can't start hc. Error %d", err);
>  			return 2;
>  		}
>  
>  		err = cmap_get_string(cmap_handle, key_name, &str);
>  		if (err != CS_OK) {
> -			syslog (LOG_INFO, "Could not get \"state\" key: %d.\n", err);
> +			qb_log (LOG_INFO, "Could not get \"state\" key: %d.", err);
>  			return (2);
>  		}
>  
>  		if (strcmp(str, "running") != 0) {
> -			syslog (LOG_INFO, "State key is not \"running\".\n");
> +			qb_log (LOG_INFO, "State key is not \"running\".");
>  			return (2);
>  		}
>  		free(str);
>  
> -		syslog (LOG_INFO, "%s iid %d: stop\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: stop", instance_id);
>  		err = sam_stop ();
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Can't stop hc. Error %d\n", err);
> +			qb_log (LOG_ERR, "Can't stop hc. Error %d", err);
>  			return 2;
>  		}
>  
>  		err = cmap_get_string(cmap_handle, key_name, &str);
>  		if (err != CS_OK) {
> -			syslog (LOG_INFO, "Could not get \"state\" key: %d.\n", err);
> +			qb_log (LOG_INFO, "Could not get \"state\" key: %d.", err);
>  			return (2);
>  		}
>  
>  		if (strcmp(str, "stopped") != 0) {
> -			syslog (LOG_INFO, "State key is not \"stopped\".\n");
> +			qb_log (LOG_INFO, "State key is not \"stopped\".");
>  			return (2);
>  		}
>  		free(str);
>  
> -		syslog (LOG_INFO, "%s iid %d: sleeping 5\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: sleeping 5", instance_id);
>  		sleep (5);
>  
>  		err = cmap_get_string(cmap_handle, key_name, &str);
>  		if (err != CS_OK) {
> -			syslog (LOG_INFO, "Could not get \"state\" key: %d.\n", err);
> +			qb_log (LOG_INFO, "Could not get \"state\" key: %d.", err);
>  			return (2);
>  		}
>  
>  		if (strcmp(str, "stopped") != 0) {
> -			syslog (LOG_INFO, "State key is not \"stopped\".\n");
> +			qb_log (LOG_INFO, "State key is not \"stopped\".");
>  			return (2);
>  		}
>  		free(str);
>  
> -		syslog (LOG_INFO, "%s iid %d: start 2\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, "%s iid %d: start 2", instance_id);
>  		err = sam_start ();
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Can't start hc. Error %d\n", err);
> +			qb_log (LOG_ERR, "Can't start hc. Error %d", err);
>  			return 2;
>  		}
>  
>  		err = cmap_get_string(cmap_handle, key_name, &str);
>  		if (err != CS_OK) {
> -			syslog (LOG_INFO, "Could not get \"state\" key: %d.\n", err);
> +			qb_log (LOG_INFO, "Could not get \"state\" key: %d.", err);
>  			return (2);
>  		}
>  
>  		if (strcmp(str, "running") != 0) {
> -			syslog (LOG_INFO, "State key is not \"running\".\n");
> +			qb_log (LOG_INFO, "State key is not \"running\".");
>  			return (2);
>  		}
>  		free(str);
>  
>  		if (test_n == 2) {
> -			syslog (LOG_INFO, "%s iid %d: sleeping 5. Should be killed\n", __FUNCTION__, instance_id);
> +			qb_log (LOG_INFO, "%s iid %d: sleeping 5. Should be killed", instance_id);
>  			sleep (5);
>  
>  			return (2);
>  		} else {
> -			syslog (LOG_INFO, "%s iid %d: Test HC\n", __FUNCTION__, instance_id);
> +			qb_log (LOG_INFO, "%s iid %d: Test HC", instance_id);
>  			err = sam_hc_send ();
>  			if (err != CS_OK) {
> -				syslog (LOG_ERR, "Can't send hc. Error %d\n", err);
> +				qb_log (LOG_ERR, "Can't send hc. Error %d", err);
>  				return 2;
>  			}
>  
>  			snprintf(key_name, CMAP_KEYNAME_MAXLEN, "resources.process.%d.last_updated", pid);
>  			err = cmap_get_uint64(cmap_handle, key_name, &tstamp1);
>  			if (err != CS_OK) {
> -				syslog (LOG_INFO, "Could not get \"last_updated\" key: %d.\n", err);
> +				qb_log (LOG_INFO, "Could not get \"last_updated\" key: %d.", err);
>  				return (2);
>  			}
> -			syslog (LOG_INFO, "%s iid %d: Sleep 1\n", __FUNCTION__, instance_id);
> +			qb_log (LOG_INFO, "%s iid %d: Sleep 1", instance_id);
>  			sleep (1);
>  			err = sam_hc_send ();
>  			if (err != CS_OK) {
> -				syslog (LOG_ERR, "Can't send hc. Error %d\n", err);
> +				qb_log (LOG_ERR, "Can't send hc. Error %d", err);
>  				return 2;
>  			}
>  			sleep (1);
>  			err = cmap_get_uint64(cmap_handle, key_name, &tstamp2);
>  			if (err != CS_OK) {
> -				syslog (LOG_INFO, "Could not get \"last_updated\" key: %d.\n", err);
> +				qb_log (LOG_INFO, "Could not get \"last_updated\" key: %d.", err);
>  				return (2);
>  			}
>  			msec_diff = (tstamp2 - tstamp1)/CS_TIME_NS_IN_MSEC;
>  
>  			if (msec_diff < 500 || msec_diff > 2000) {
> -				syslog (LOG_INFO, "Difference %d is not within <500, 2000> interval.\n", msec_diff);
> +				qb_log (LOG_INFO, "Difference %d is not within <500, 2000> interval.", msec_diff);
>  				return (2);
>  			}
>  
> -			syslog (LOG_INFO, "%s iid %d: stop 2\n", __FUNCTION__, instance_id);
> +			qb_log (LOG_INFO, "%s iid %d: stop 2", instance_id);
>  			err = sam_stop ();
>  			if (err != CS_OK) {
> -				syslog (LOG_ERR, "Can't stop hc. Error %d\n", err);
> +				qb_log (LOG_ERR, "Can't stop hc. Error %d", err);
>  				return 2;
>  			}
>  
>  			snprintf(key_name, CMAP_KEYNAME_MAXLEN, "resources.process.%d.state", pid);
>  			err = cmap_get_string(cmap_handle, key_name, &str);
>  			if (err != CS_OK) {
> -				syslog (LOG_INFO, "Could not get \"state\" key: %d.\n", err);
> +				qb_log (LOG_INFO, "Could not get \"state\" key: %d.", err);
>  				return (2);
>  			}
>  
>  			if (strcmp(str, "stopped") != 0) {
> -				syslog (LOG_INFO, "State key is not \"stopped\".\n");
> +				qb_log (LOG_INFO, "State key is not \"stopped\".");
>  				return (2);
>  			}
>  			free(str);
>  
> -			syslog (LOG_INFO, "%s iid %d: exiting\n", __FUNCTION__, instance_id);
> +			qb_log (LOG_INFO, "%s iid %d: exiting", instance_id);
>  			return (0);
>  		}
>  	}
>  
>  	if (test_n == 3) {
> -		syslog (LOG_INFO, "%s Testing if status is failed\n", __FUNCTION__);
> +		qb_log (LOG_INFO, "%s Testing if status is failed");
>  
>  		/*
>  		 * Previous should be FAILED
> @@ -1085,12 +1085,12 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
>  		snprintf(key_name, CMAP_KEYNAME_MAXLEN, "resources.process.%d.state", pid);
>  		err = cmap_get_string(cmap_handle, key_name, &str);
>  		if (err != CS_OK) {
> -			syslog (LOG_INFO, "Could not get \"state\" key: %d.\n", err);
> +			qb_log (LOG_INFO, "Could not get \"state\" key: %d.", err);
>  			return (2);
>  		}
>  
>  		if (strcmp(str, "failed") != 0) {
> -			syslog (LOG_INFO, "State key is not \"failed\".\n");
> +			qb_log (LOG_INFO, "State key is not \"failed\".");
>  			return (2);
>  		}
>  
> @@ -1112,38 +1112,38 @@ static int test9 (pid_t pid, pid_t old_pid, int test_n) {
>  
>  	err = cmap_initialize (&cmap_handle);
>  	if (err != CS_OK) {
> -		syslog (LOG_INFO, "Could not initialize Cluster Map API instance error %d. Test skipped\n", err);
> +		qb_log (LOG_INFO, "Could not initialize Cluster Map API instance error %d. Test skipped", err);
>  		return (1);
>  	}
>  
> -	syslog (LOG_INFO, "%s test %d\n", __FUNCTION__, test_n);
> +	qb_log (LOG_INFO, "%s test %d", test_n);
>  
>  	if (test_n == 1) {
> -		syslog (LOG_INFO, "%s: initialize\n", __FUNCTION__);
> +		qb_log (LOG_INFO, " initialize");
>  		err = sam_initialize (2000, SAM_RECOVERY_POLICY_RESTART | SAM_RECOVERY_POLICY_CMAP);
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Can't initialize SAM API. Error %d\n", err);
> +			qb_log (LOG_ERR, "Can't initialize SAM API. Error %d", err);
>  			return 2;
>  		}
>  
> -		syslog (LOG_INFO, "%s: register\n", __FUNCTION__);
> +		qb_log (LOG_INFO, " register");
>  		err = sam_register (&instance_id);
>  		if (err != CS_OK) {
> -			syslog (LOG_ERR, "Can't register. Error %d\n", err);
> +			qb_log (LOG_ERR, "Can't register. Error %d", err);
>  			return 2;
>  		}
> -		syslog (LOG_INFO, "%s: iid %d\n", __FUNCTION__, instance_id);
> +		qb_log (LOG_INFO, " iid %d", instance_id);
>  
>  		if (instance_id < 3) {
>  			snprintf(key_name, CMAP_KEYNAME_MAXLEN, "resources.process.%d.recovery", pid);
>  			err = cmap_get_string(cmap_handle, key_name, &str);
>  			if (err != CS_OK) {
> -				syslog (LOG_INFO, "Could not get \"recovery\" key: %d.\n", err);
> +				qb_log (LOG_INFO, "Could not get \"recovery\" key: %d.", err);
>  				return (2);
>  			}
>  
>  			if (strcmp(str, "restart") != 0) {
> -				syslog (LOG_INFO, "Recovery key \"%s\" is not \"restart\".\n", str);
> +				qb_log (LOG_INFO, "Recovery key \"%s\" is not \"restart\".", str);
>  				return (2);
>  			}
>  			free(str);
> @@ -1151,50 +1151,50 @@ static int test9 (pid_t pid, pid_t old_pid, int test_n) {
>  			snprintf(key_name, CMAP_KEYNAME_MAXLEN, "resources.process.%d.state", pid);
>  			err = cmap_get_string(cmap_handle, key_name, &str);
>  			if (err != CS_OK) {
> -				syslog (LOG_INFO, "Could not get \"state\" key: %d.\n", err);
> +				qb_log (LOG_INFO, "Could not get \"state\" key: %d.", err);
>  				return (2);
>  			}
>  
>  			if (strcmp(str, "stopped") != 0) {
> -				syslog (LOG_INFO, "State key is not \"stopped\".\n");
> +				qb_log (LOG_INFO, "State key is not \"stopped\".");
>  				return (2);
>  			}
>  			free(str);
>  
> -			syslog (LOG_INFO, "%s iid %d: start\n", __FUNCTION__, instance_id);
> +			qb_log (LOG_INFO, "%s iid %d: start", instance_id);
>  			err = sam_start ();
>  			if (err != CS_OK) {
> -				syslog (LOG_ERR, "Can't start hc. Error %d\n", err);
> +				qb_log (LOG_ERR, "Can't start hc. Error %d", err);
>  				return 2;
>  			}
>  
>  			err = cmap_get_string(cmap_handle, key_name, &str);
>  			if (err != CS_OK) {
> -				syslog (LOG_INFO, "Could not get \"state\" key: %d.\n", err);
> +				qb_log (LOG_INFO, "Could not get \"state\" key: %d.", err);
>  				return (2);
>  			}
>  
>  			if (strcmp(str, "running") != 0) {
> -				syslog (LOG_INFO, "State key is not \"running\".\n");
> +				qb_log (LOG_INFO, "State key is not \"running\".");
>  				return (2);
>  			}
>  			free(str);
>  
> -			syslog (LOG_INFO, "%s iid %d: waiting for kill\n", __FUNCTION__, instance_id);
> +			qb_log (LOG_INFO, "%s iid %d: waiting for kill", instance_id);
>  			sleep (10);
>  
>  			return (2);
>  		}
>  
>  		if (instance_id == 3) {
> -			syslog (LOG_INFO, "%s iid %d: mark failed\n", __FUNCTION__, instance_id);
> +			qb_log (LOG_INFO, "%s iid %d: mark failed", instance_id);
>  			if (err != CS_OK) {
> -				syslog (LOG_ERR, "Can't start hc. Error %d\n", err);
> +				qb_log (LOG_ERR, "Can't start hc. Error %d", err);
>  				return 2;
>  			}
>  			err = sam_mark_failed ();
>  			if (err != CS_OK) {
> -				syslog (LOG_ERR, "Can't mark failed. Error %d\n", err);
> +				qb_log (LOG_ERR, "Can't mark failed. Error %d", err);
>  				return 2;
>  			}
>  
> @@ -1207,7 +1207,7 @@ static int test9 (pid_t pid, pid_t old_pid, int test_n) {
>  	}
>  
>  	if (test_n == 2) {
> -		syslog (LOG_INFO, "%s Testing if status is failed\n", __FUNCTION__);
> +		qb_log (LOG_INFO, "%s Testing if status is failed");
>  
>  		/*
>  		 * Previous should be FAILED
> @@ -1215,12 +1215,12 @@ static int test9 (pid_t pid, pid_t old_pid, int test_n) {
>  		snprintf(key_name, CMAP_KEYNAME_MAXLEN, "resources.process.%d.state", pid);
>  		err = cmap_get_string(cmap_handle, key_name, &str);
>  		if (err != CS_OK) {
> -			syslog (LOG_INFO, "Could not get \"state\" key: %d.\n", err);
> +			qb_log (LOG_INFO, "Could not get \"state\" key: %d.", err);
>  			return (2);
>  		}
>  
>  		if (strcmp(str, "failed") != 0) {
> -			syslog (LOG_INFO, "State key is not \"failed\".\n");
> +			qb_log (LOG_INFO, "State key is not \"failed\".");
>  			return (2);
>  		}
>  		free(str);
> @@ -1233,7 +1233,7 @@ static int test9 (pid_t pid, pid_t old_pid, int test_n) {
>  
>  static int hc_allways_respond_cb(void)
>  {
> -	syslog (LOG_INFO, "%s() -> health check OK.", __FUNCTION__);
> +	qb_log (LOG_INFO, "%s() -> health check OK.");
>  	return 0;
>  }
>  
> @@ -1244,22 +1244,22 @@ static int setup_hc (void)
>  
>  	err = sam_initialize (1000, SAM_RECOVERY_POLICY_QUIT | SAM_RECOVERY_POLICY_CMAP);
>  	if (err != CS_OK) {
> -		syslog (LOG_ERR, "Can't initialize SAM API. Error %d\n", err);
> +		qb_log (LOG_ERR, "Can't initialize SAM API. Error %d", err);
>  		return 2;
>  	}
>  
> -	syslog (LOG_INFO, "%s: register\n", __FUNCTION__);
> +	qb_log (LOG_INFO, " register");
>  	err = sam_register (&instance_id);
>  	if (err != CS_OK) {
> -		syslog (LOG_ERR, "Can't register. Error %d\n", err);
> +		qb_log (LOG_ERR, "Can't register. Error %d", err);
>  		return 2;
>  	}
>  	err = sam_hc_callback_register (hc_allways_respond_cb);
>  
> -	syslog (LOG_INFO, "%s instance id %d: start\n", __FUNCTION__, instance_id);
> +	qb_log (LOG_INFO, "%s instance id %d: start", instance_id);
>  	err = sam_start ();
>  	if (err != CS_OK) {
> -		syslog (LOG_ERR, "Can't start hc. Error %d\n", err);
> +		qb_log (LOG_ERR, "Can't start hc. Error %d", err);
>  		return 2;
>  	}
>  
> @@ -1275,7 +1275,7 @@ static int do_test_command(int sock, char* func, char*args[], int num_args)
>  	pid = fork ();
>  
>  	if (pid == -1) {
> -		syslog (LOG_ERR, "Can't fork\n");
> +		qb_log (LOG_ERR, "Can't fork");
>  		return -1;
>  	}
>  
> @@ -1318,7 +1318,7 @@ static void do_command (int sock, char* func, char*args[], int num_args)
>  	int err = 0;
>  
>  	if (parse_debug) {
> -		syslog (LOG_INFO, "RPC:%s() called.", func);
> +		qb_log (LOG_INFO, "RPC:%s() called.", func);
>  	}
>  	if (strncmp ("test", func, 4) == 0) {
>  		err = do_test_command(sock, func, args, num_args);
> @@ -1328,13 +1328,13 @@ static void do_command (int sock, char* func, char*args[], int num_args)
>  		err = sam_stop ();
>  		if (err != CS_OK) {
>  			err = -1;
> -			syslog (LOG_ERR,"%s RPC:%s sam_stop failed!", __func__, func);
> +			qb_log (LOG_ERR,"%s RPC:%s sam_stop failed!", __func__, func);
>  			snprintf (response, 100, "%s", FAIL_STR);
>  		}
>  		err = sam_finalize();
>  	} else {
>  		err = -1;
> -		syslog (LOG_ERR,"%s RPC:%s not supported!", __func__, func);
> +		qb_log (LOG_ERR,"%s RPC:%s not supported!", __func__, func);
>  		snprintf (response, 100, "%s", NOT_SUPPORTED_STR);
>  	}
>  
> @@ -1342,24 +1342,17 @@ static void do_command (int sock, char* func, char*args[], int num_args)
>  		snprintf (response, 100, "%s", OK_STR);
>  	} else if (err == 1) {
>  		snprintf (response, 100, "%s", FAIL_STR);
> -		syslog (LOG_ERR, "%s() test skipped?! (%d).", func, err);
> +		qb_log (LOG_ERR, "%s() test skipped?! (%d).", func, err);
>  	} else {
>  		snprintf (response, 100, "%s", FAIL_STR);
> -		syslog (LOG_ERR, "%s() failed (%d).", func, err);
> +		qb_log (LOG_ERR, "%s() failed (%d).", func, err);
>  	}
>  	send (sock, response, strlen (response) + 1, 0);
>  }
>  
> -int main (int argc, char *argv[])
> +int
> +main (int argc, char *argv[])
>  {
> -	int ret;
> -
> -	openlog (NULL, LOG_CONS|LOG_PID, LOG_DAEMON);
> -	syslog (LOG_INFO, "%s STARTNG", __FILE__);
> -
>  	parse_debug = 1;
> -	ret = test_agent_run (9036, do_command, NULL);
> -	syslog (LOG_INFO, "%s EXITING", __FILE__);
> -
> -	return ret;
> +	return test_agent_run ("sam_test_agent", 9036, do_command, NULL);
>  }
> diff --git a/cts/agents/votequorum_test_agent.c b/cts/agents/votequorum_test_agent.c
> index 15f4a0a..303d5b9 100644
> --- a/cts/agents/votequorum_test_agent.c
> +++ b/cts/agents/votequorum_test_agent.c
> @@ -45,7 +45,6 @@
>  #include <arpa/inet.h>
>  #include <netdb.h>
>  #include <sys/un.h>
> -#include <syslog.h>
>  #include <poll.h>
>  
>  #include <qb/qbloop.h>
> @@ -65,7 +64,7 @@ static void votequorum_notification_fn(
>  	uint32_t node_list_entries,
>  	votequorum_node_t node_list[])
>  {
> -	syslog (LOG_INFO, "VQ notification quorate: %d", quorate);
> +	qb_log (LOG_INFO, "VQ notification quorate: %d", quorate);
>  }
>  
>  static void quorum_notification_fn(
> @@ -75,7 +74,7 @@ static void quorum_notification_fn(
>  	uint32_t view_list_entries,
>  	uint32_t *view_list)
>  {
> -	syslog (LOG_INFO, "NQ notification quorate: %d", quorate);
> +	qb_log (LOG_INFO, "NQ notification quorate: %d", quorate);
>  }
>  
>  
> @@ -86,7 +85,7 @@ static int vq_dispatch_wrapper_fn (
>  {
>  	cs_error_t error = votequorum_dispatch (vq_handle, CS_DISPATCH_ALL);
>  	if (error != CS_OK) {
> -		syslog (LOG_ERR, "%s() got %s error, disconnecting.",
> +		qb_log (LOG_ERR, "%s() got %s error, disconnecting.",
>  			__func__, cs_strerror(error));
>  		votequorum_finalize(vq_handle);
>  		qb_loop_poll_del (ta_poll_handle_get(), fd);
> @@ -104,7 +103,7 @@ static int q_dispatch_wrapper_fn (
>  {
>  	cs_error_t error = quorum_dispatch (q_handle, CS_DISPATCH_ALL);
>  	if (error != CS_OK) {
> -		syslog (LOG_ERR, "%s() got %s error, disconnecting.",
> +		qb_log (LOG_ERR, "%s() got %s error, disconnecting.",
>  			__func__, cs_strerror(error));
>  		quorum_finalize(q_handle);
>  		qb_loop_poll_del (ta_poll_handle_get(), fd);
> @@ -124,7 +123,7 @@ static int q_lib_init(void)
>  	int fd;
>  
>  	if (vq_handle == 0) {
> -		syslog (LOG_INFO, "votequorum_initialize");
> +		qb_log (LOG_INFO, "votequorum_initialize");
>  		vq_callbacks.votequorum_notify_fn = votequorum_notification_fn;
>  		vq_callbacks.votequorum_expectedvotes_notify_fn = NULL;
>  		ret = CS_ERR_NOT_EXIST;
> @@ -136,13 +135,13 @@ static int q_lib_init(void)
>  			}
>  		}
>  		if (ret != CS_OK) {
> -			syslog (LOG_ERR, "votequorum_initialize FAILED: %d\n", ret);
> +			qb_log (LOG_ERR, "votequorum_initialize FAILED: %d\n", ret);
>  			vq_handle = 0;
>  		}
>  		else {
>  			ret = votequorum_trackstart (vq_handle, vq_handle, CS_TRACK_CHANGES);
>  			if (ret != CS_OK) {
> -				syslog (LOG_ERR, "votequorum_trackstart FAILED: %d\n", ret);
> +				qb_log (LOG_ERR, "votequorum_trackstart FAILED: %d\n", ret);
>  			}
>  
>  			votequorum_fd_get (vq_handle, &fd);
> @@ -152,17 +151,17 @@ static int q_lib_init(void)
>  	}
>  	if (q_handle == 0) {
>  		uint32_t q_type;
> -		syslog (LOG_INFO, "quorum_initialize");
> +		qb_log (LOG_INFO, "quorum_initialize");
>  		q_callbacks.quorum_notify_fn = quorum_notification_fn;
>  		ret = quorum_initialize (&q_handle, &q_callbacks, &q_type);
>  		if (ret != CS_OK) {
> -			syslog (LOG_ERR, "quorum_initialize FAILED: %d\n", ret);
> +			qb_log (LOG_ERR, "quorum_initialize FAILED: %d\n", ret);
>  			q_handle = 0;
>  		}
>  		else {
>  			ret = quorum_trackstart (q_handle, CS_TRACK_CHANGES);
>  			if (ret != CS_OK) {
> -				syslog (LOG_ERR, "quorum_trackstart FAILED: %d\n", ret);
> +				qb_log (LOG_ERR, "quorum_trackstart FAILED: %d\n", ret);
>  			}
>  			quorum_fd_get (q_handle, &fd);
>  			qb_loop_poll_add (ta_poll_handle_get(), QB_LOOP_MED, fd,
> @@ -182,7 +181,7 @@ static void lib_init (int sock)
>  
>  	if (ret != CS_OK) {
>  		snprintf (response, 100, "%s", FAIL_STR);
> -		syslog (LOG_ERR, "q_lib_init FAILED: %d\n", ret);
> +		qb_log (LOG_ERR, "q_lib_init FAILED: %d\n", ret);
>  	}
>  
>  	send (sock, response, strlen (response), 0);
> @@ -199,7 +198,7 @@ static void getinfo (int sock)
>  	ret = votequorum_getinfo(vq_handle, 0, &info);
>  	if (ret != CS_OK) {
>  		snprintf (response, 100, "%s", FAIL_STR);
> -		syslog (LOG_ERR, "votequorum_getinfo FAILED: %d\n", ret);
> +		qb_log (LOG_ERR, "votequorum_getinfo FAILED: %d\n", ret);
>  		goto send_response;
>  	}
>  
> @@ -225,7 +224,7 @@ static void setexpected (int sock, char *arg)
>  	ret = votequorum_setexpected (vq_handle, atoi(arg));
>  	if (ret != CS_OK) {
>  		snprintf (response, 100, "%s", FAIL_STR);
> -		syslog (LOG_ERR, "set expected votes FAILED: %d\n", ret);
> +		qb_log (LOG_ERR, "set expected votes FAILED: %d\n", ret);
>  		goto send_response;
>  	}
>  
> @@ -245,7 +244,7 @@ static void setvotes (int sock, char *arg)
>  	ret = votequorum_setvotes (vq_handle, 0, atoi(arg));
>  	if (ret != CS_OK) {
>  		snprintf (response, 100, "%s", FAIL_STR);
> -		syslog (LOG_ERR, "set votes FAILED: %d\n", ret);
> +		qb_log (LOG_ERR, "set votes FAILED: %d\n", ret);
>  		goto send_response;
>  	}
>  
> @@ -267,7 +266,7 @@ static void getquorate (int sock)
>  	ret = quorum_getquorate (q_handle, &quorate);
>  	if (ret != CS_OK) {
>  		snprintf (response, 100, "%s", FAIL_STR);
> -		syslog (LOG_ERR, "getquorate FAILED: %d\n", ret);
> +		qb_log (LOG_ERR, "getquorate FAILED: %d\n", ret);
>  		goto send_response;
>  	}
>  
> @@ -288,14 +287,14 @@ static void context_test (int sock)
>  	votequorum_context_get (vq_handle, (void**)&cmp);
>  	if (response != cmp) {
>  		snprintf (response, 100, "%s", FAIL_STR);
> -		syslog (LOG_ERR, "votequorum context not the same");
> +		qb_log (LOG_ERR, "votequorum context not the same");
>  	}
>  
>  	quorum_context_set (q_handle, response);
>  	quorum_context_get (q_handle, (const void**)&cmp);
>  	if (response != cmp) {
>  		snprintf (response, 100, "%s", FAIL_STR);
> -		syslog (LOG_ERR, "quorum context not the same");
> +		qb_log (LOG_ERR, "quorum context not the same");
>  	}
>  	send (sock, response, strlen (response) + 1, 0);
>  }
> @@ -305,7 +304,7 @@ static void do_command (int sock, char* func, char*args[], int num_args)
>  	char response[100];
>  
>  	if (parse_debug)
> -		syslog (LOG_DEBUG,"RPC:%s() called.", func);
> +		qb_log (LOG_DEBUG,"RPC:%s() called.", func);
>  
>  	if (strcmp ("votequorum_getinfo", func) == 0) {
>  		getinfo (sock);
> @@ -323,7 +322,7 @@ static void do_command (int sock, char* func, char*args[], int num_args)
>  		snprintf (response, 100, "%s", OK_STR);
>  		send (sock, response, strlen (response) + 1, 0);
>  	} else {
> -		syslog (LOG_ERR,"%s RPC:%s not supported!", __func__, func);
> +		qb_log (LOG_ERR,"%s RPC:%s not supported!", __func__, func);
>  		snprintf (response, 100, "%s", NOT_SUPPORTED_STR);
>  		send (sock, response, strlen (response), 0);
>  	}
> @@ -331,7 +330,7 @@ static void do_command (int sock, char* func, char*args[], int num_args)
>  
>  static void my_pre_exit(void)
>  {
> -	syslog (LOG_INFO, "PRE EXIT");
> +	qb_log (LOG_INFO, "PRE EXIT");
>  	if (vq_handle) {
>  		votequorum_finalize(vq_handle);
>  		vq_handle = 0;
> @@ -342,18 +341,9 @@ static void my_pre_exit(void)
>  	}
>  }
>  
> -int main (int argc, char *argv[])
> +int
> +main(int argc, char *argv[])
>  {
> -	int ret;
> -
> -	openlog (NULL, LOG_CONS|LOG_PID, LOG_DAEMON);
> -	syslog (LOG_INFO, "%s STARTING", __FILE__);
> -
>  	parse_debug = 1;
> -	ret = test_agent_run (9037, do_command, my_pre_exit);
> -	syslog (LOG_INFO, "EXITING");
> -
> -	return ret;
> +	return test_agent_run ("quorum_test_agent", 9037, do_command, my_pre_exit);
>  }
> -
> -

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux