Przeglądaj źródła

- printouts buffered before log_setup() has been called, flushed at early exit.
- rests of old logging removed from all code (#define LOG_SERVICE...).
- line feed added if not in message.
- new trace() function added so that trace macros adds minimum of code and runtime penalties to user code.
- ENTER_ARGS macro changed to ENTER. ENTER macro now requires arguments.
- openais.conf.5 man page updated with logger directives.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1021 fd59a12c-fef9-0310-b244-a6a79926bd2f

Hans Feldt 20 lat temu
rodzic
commit
905ba3b406
20 zmienionych plików z 323 dodań i 141 usunięć
  1. 12 12
      exec/amf.c
  2. 1 2
      exec/cfg.c
  3. 1 2
      exec/ckpt.c
  4. 0 3
      exec/clm.c
  5. 0 2
      exec/cpg.c
  6. 11 3
      exec/evs.c
  7. 1 2
      exec/evt.c
  8. 2 0
      exec/ipc.c
  9. 0 2
      exec/lck.c
  10. 0 2
      exec/main.c
  11. 17 23
      exec/mainconfig.c
  12. 0 2
      exec/msg.c
  13. 165 56
      exec/print.c
  14. 70 19
      exec/print.h
  15. 0 1
      exec/service.c
  16. 0 3
      exec/sync.c
  17. 0 2
      exec/totemconfig.c
  18. 1 1
      exec/util.c
  19. 0 3
      exec/vsf_ykd.c
  20. 42 1
      man/openais.conf.5

+ 12 - 12
exec/amf.c

@@ -64,9 +64,8 @@
 #include "main.h"
 #include "service.h"
 #include "objdb.h"
-
-#define LOG_SERVICE LOG_SERVICE_AMF
 #include "print.h"
+
 #define LOG_LEVEL_FROM_LIB LOG_LEVEL_DEBUG
 #define LOG_LEVEL_FROM_GMI LOG_LEVEL_DEBUG
 #define LOG_LEVEL_ENTER_FUNC LOG_LEVEL_DEBUG
@@ -682,7 +681,7 @@ int clc_cli_instantiate (struct amf_comp *comp)
 
 	struct clc_command_run_data *clc_command_run_data;
 
-	ENTER_ARGS("comp %s\n", getSaNameT (&comp->name));
+	ENTER("comp %s\n", getSaNameT (&comp->name));
 
 	clc_command_run_data = malloc (sizeof (struct clc_command_run_data));
 	clc_command_run_data->comp = comp;
@@ -696,13 +695,13 @@ int clc_cli_instantiate (struct amf_comp *comp)
 
 int clc_instantiate_callback (struct amf_comp *comp)
 {
-	ENTER_ARGS("comp %s\n", getSaNameT (&comp->name));
+	ENTER("comp %s\n", getSaNameT (&comp->name));
 	return (0);
 }
 
 int clc_csi_set_callback (struct amf_comp *comp)
 {
-	ENTER_ARGS("comp %s\n", getSaNameT (&comp->name));
+	ENTER("comp %s\n", getSaNameT (&comp->name));
 	return (0);
 }
 
@@ -711,7 +710,7 @@ int clc_csi_set_callback (struct amf_comp *comp)
  */
 int clc_cli_terminate (struct amf_comp *comp)
 {
-	ENTER_ARGS("comp %s\n", getSaNameT (&comp->name));
+	ENTER("comp %s\n", getSaNameT (&comp->name));
 	return (0);
 }
 int clc_terminate_callback (struct amf_comp *comp)
@@ -719,7 +718,7 @@ int clc_terminate_callback (struct amf_comp *comp)
 	struct res_lib_amf_componentterminatecallback res_lib_amf_componentterminatecallback;
 	struct component_terminate_callback_data *component_terminate_callback_data;
 
-	ENTER_ARGS("comp %s\n", getSaNameT (&comp->name));
+	ENTER("comp %s\n", getSaNameT (&comp->name));
 
 	if (comp->presence_state != SA_AMF_PRESENCE_INSTANTIATED) {
 		dprintf ("component terminated but not instantiated %s - %d\n",
@@ -931,6 +930,8 @@ int amf_lib_exit_fn (void *conn)
 
 	comp = amf_pd->comp;
 
+	TRACE8("amf_lib_exit_fn");
+
 	if (comp) {
 		comp->conn = 0;
 
@@ -2291,9 +2292,8 @@ void healthcheck_activate (struct healthcheck_active *healthcheck_active)
 	res_lib_amf_healthcheckcallback.header.size = sizeof (struct res_lib_amf_healthcheckcallback);
 	res_lib_amf_healthcheckcallback.header.error = SA_AIS_OK;
 
-
-	log_printf (LOG_LEVEL_DEBUG, "sending healthcheck to component %s\n",
-		getSaNameT (&healthcheck_active->comp->name));
+	TRACE8 ("sending healthcheck to component %s",
+			getSaNameT (&healthcheck_active->comp->name));
 
 	res_lib_amf_healthcheckcallback.invocation =
 		invocation_create (
@@ -3004,7 +3004,7 @@ static void message_handler_req_lib_amf_response (void *conn, void *msg)
 	void *data;
 	SaAisErrorT error = SA_AIS_OK;
 
-	ENTER();
+	ENTER_VOID();
 
 	res = invocation_get_and_destroy (req_lib_amf_response->invocation,
 		&interface, &data);
@@ -3080,7 +3080,7 @@ error_exit:
 	openais_conn_send_response (conn, &res_lib_amf_response,
 		sizeof (struct res_lib_amf_response));
 
-	LEAVE();
+	LEAVE_VOID();
 }
 
 

+ 1 - 2
exec/cfg.c

@@ -58,9 +58,8 @@
 #include "aispoll.h"
 #include "mempool.h"
 #include "util.h"
-
-#define LOG_SERVICE LOG_SERVICE_AMF
 #include "print.h"
+
 #define LOG_LEVEL_FROM_LIB LOG_LEVEL_DEBUG
 #define LOG_LEVEL_FROM_GMI LOG_LEVEL_DEBUG
 #define LOG_LEVEL_ENTER_FUNC LOG_LEVEL_DEBUG

+ 1 - 2
exec/ckpt.c

@@ -59,10 +59,9 @@
 #include "util.h"
 #include "main.h"
 #include "totempg.h"
+#include "print.h"
 
-#define LOG_SERVICE LOG_SERVICE_CKPT
 #define CKPT_MAX_SECTION_DATA_SEND (1024*400)
-#include "print.h"
 
 enum ckpt_message_req_types {
 	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTOPEN = 0,

+ 0 - 3
exec/clm.c

@@ -67,11 +67,8 @@
 #include "main.h"
 #include "mempool.h"
 #include "service.h"
-
-#define LOG_SERVICE LOG_SERVICE_CLM
 #include "print.h"
 
-
 enum clm_message_req_types {
 	MESSAGE_REQ_EXEC_CLM_NODEJOIN = 0
 };

+ 0 - 2
exec/cpg.c

@@ -63,8 +63,6 @@
 #include "service.h"
 #include "jhash.h"
 #include "swab.h"
-
-#define LOG_SERVICE LOG_SERVICE_CPG
 #include "print.h"
 
 #define GROUP_HASH_SIZE 32

+ 11 - 3
exec/evs.c

@@ -60,8 +60,6 @@
 #include "main.h"
 #include "mempool.h"
 #include "service.h"
-
-#define LOG_SERVICE LOG_SERVICE_EVS
 #include "print.h"
 
 enum evs_exec_message_req_types {
@@ -71,6 +69,7 @@ enum evs_exec_message_req_types {
 /*
  * Service Interfaces required by service_message_handler struct
  */
+static int evs_exec_init_fn(struct objdb_iface_ver0 *objdb);
 static void evs_confchg_fn (
 	enum totem_configuration_type configuration_type,
 	struct totem_ip_address *member_list, int member_list_entries,
@@ -151,7 +150,7 @@ struct openais_service_handler evs_service_handler = {
 	.exec_service		= evs_exec_service,
 	.exec_service_count	= sizeof (evs_exec_service) / sizeof (struct openais_exec_handler),
 	.confchg_fn		= evs_confchg_fn,
-	.exec_init_fn		= NULL,
+	.exec_init_fn		= evs_exec_init_fn,
 	.exec_dump_fn		= NULL
 };
 
@@ -197,6 +196,15 @@ __attribute__ ((constructor)) static void evs_comp_register (void) {
 	lcr_component_register (&evs_comp_ver0);
 }
 
+static int evs_exec_init_fn(struct objdb_iface_ver0 *objdb)
+{
+	(void) objdb;
+
+	log_init ("EVS");
+
+	return 0;
+}
+
 struct res_evs_confchg_callback res_evs_confchg_callback;
 
 static void evs_confchg_fn (

+ 1 - 2
exec/evt.c

@@ -61,8 +61,6 @@
 #include "totemip.h"
 #include "totempg.h"
 #include "swab.h"
-
-#define LOG_SERVICE LOG_SERVICE_EVT
 #include "print.h"
 
 /*
@@ -3035,6 +3033,7 @@ static int evt_exec_init(struct objdb_iface_ver0 *objdb)
 	unsigned int object_service_handle;
 	char *value;
 
+	log_init ("EVT");
 	log_printf(LOG_LEVEL_DEBUG, "Evt exec init request\n");
 
 	objdb->object_find_reset (OBJECT_PARENT_HANDLE);

+ 2 - 0
exec/ipc.c

@@ -803,6 +803,8 @@ void openais_ipc_init (
 	struct sockaddr_un un_addr;
 	int res;
 
+	log_init ("IPC");
+
 	/*
 	 * Create socket for libais clients, name socket, listen for connections
 	 */

+ 0 - 2
exec/lck.c

@@ -58,8 +58,6 @@
 #include "util.h"
 #include "main.h"
 #include "totempg.h"
-
-#define LOG_SERVICE LOG_SERVICE_LCK
 #include "print.h"
 
 

+ 0 - 2
exec/main.c

@@ -72,9 +72,7 @@
 #include "objdb.h"
 #include "config.h"
 #include "ipc.h"
-#define LOG_SERVICE LOG_SERVICE_MAIN
 #include "print.h"
-
 #include "util.h"
 
 #define SERVER_BACKLOG 5

+ 17 - 23
exec/mainconfig.c

@@ -202,33 +202,27 @@ int openais_main_config_read (
 				while (token != NULL) {
 					if (strcmp (token, "enter") == 0) {
 						main_config->logger[i].tags |= TAG_ENTER;
-					} else
-					if (strcmp (token, "leave") == 0) {
+					} else if (strcmp (token, "leave") == 0) {
 						main_config->logger[i].tags |= TAG_LEAVE;
-					} else
-					if (strcmp (token, "trace1") == 0) {
+					} else if (strcmp (token, "trace1") == 0) {
 						main_config->logger[i].tags |= TAG_TRACE1;
-					} else
-					if (strcmp (token, "trace2") == 0) {
+					} else if (strcmp (token, "trace2") == 0) {
 						main_config->logger[i].tags |= TAG_TRACE2;
-					} else
-					if (strcmp (token, "trace3") == 0) {
-						main_config->logger[i].tags |= TAG_TRACE3;
-					}
-					if (strcmp (token, "trace4") == 0) {
-						main_config->logger[i].tags |= TAG_TRACE3;
-					}
-					if (strcmp (token, "trace5") == 0) {
-						main_config->logger[i].tags |= TAG_TRACE3;
-					}
-					if (strcmp (token, "trace6") == 0) {
-						main_config->logger[i].tags |= TAG_TRACE3;
-					}
-					if (strcmp (token, "trace7") == 0) {
-						main_config->logger[i].tags |= TAG_TRACE3;
-					}
-					if (strcmp (token, "trace8") == 0) {
+					} else if (strcmp (token, "trace3") == 0) {
 						main_config->logger[i].tags |= TAG_TRACE3;
+					} else if (strcmp (token, "trace4") == 0) {
+						main_config->logger[i].tags |= TAG_TRACE4;
+					} else if (strcmp (token, "trace5") == 0) {
+						main_config->logger[i].tags |= TAG_TRACE5;
+					} else if (strcmp (token, "trace6") == 0) {
+						main_config->logger[i].tags |= TAG_TRACE6;
+					} else if (strcmp (token, "trace7") == 0) {
+						main_config->logger[i].tags |= TAG_TRACE7;
+					} else if (strcmp (token, "trace8") == 0) {
+						main_config->logger[i].tags |= TAG_TRACE8;
+					} else {
+						error_reason = "bad tags value";
+						goto parse_error;
 					}
 
 					token = strtok(NULL, "|");

+ 0 - 2
exec/msg.c

@@ -58,8 +58,6 @@
 #include "util.h"
 #include "main.h"
 #include "totempg.h"
-
-#define LOG_SERVICE LOG_SERVICE_MSG
 #include "print.h"
 
 enum msg_exec_message_req_types {

+ 165 - 56
exec/print.c

@@ -52,35 +52,45 @@
 #include <sys/un.h>
 #endif
 #include <syslog.h>
+#include <stdlib.h>
+
 #include "print.h"
 #include "totemip.h"
 #include "../include/saAis.h"
 
-static unsigned int logmode = LOG_MODE_STDERR | LOG_MODE_SYSLOG;
+static unsigned int logmode = LOG_MODE_BUFFER | LOG_MODE_STDERR | LOG_MODE_SYSLOG;
 static char *logfile = 0;
+static int log_setup_called;
 
+#ifndef MAX_LOGGERS
 #define MAX_LOGGERS 32
+#endif
 struct logger loggers[MAX_LOGGERS];
 
-#define LOG_MODE_DEBUG      1
-#define LOG_MODE_TIMESTAMP  2
-#define LOG_MODE_FILE       4
-#define LOG_MODE_SYSLOG     8
-#define LOG_MODE_STDERR     16
-
 static FILE *log_file_fp = 0;
 
-struct sockaddr_un syslog_sockaddr = {
-	sun_family: AF_UNIX,
-	sun_path: "/dev/log"
+struct log_entry
+{
+	char *file;
+	int line;
+	int level;
+	char str[128];
+	struct log_entry *next;
 };
 
+static struct log_entry *head;
+static struct log_entry *tail;
+
 static int logger_init (const char *ident, int tags, int level, int mode)
 {
 	int i;
 
-	for (i = 0; i < MAX_LOGGERS; i++) {
+ 	for (i = 0; i < MAX_LOGGERS; i++) {
 		if (strcmp (loggers[i].ident, ident) == 0) {
+			loggers[i].tags |= tags;
+			if (level > loggers[i].level) {
+				loggers[i].level = level;
+			}
 			break;
 		}
 	}
@@ -91,8 +101,6 @@ static int logger_init (const char *ident, int tags, int level, int mode)
 				strncpy (loggers[i].ident, ident, sizeof(loggers[i].ident));
 				loggers[i].tags = tags;
 				loggers[i].level = level;
-				if (logmode & LOG_MODE_DEBUG)
-					loggers[i].level = LOG_LEVEL_DEBUG;
 				loggers[i].mode = mode;
 				break;
 			}
@@ -104,58 +112,45 @@ static int logger_init (const char *ident, int tags, int level, int mode)
 	return i;
 }
 
-int _log_init (const char *ident)
-{
-	assert (ident != NULL);
-
-	return logger_init (ident, TAG_LOG, LOG_LEVEL_INFO, 0);
-}
-
-int log_setup (char **error_string, struct main_config *config)
+static void buffered_log_printf (char *file, int line, int level,
+								 char *format, va_list ap)
 {
-	int i;
-	static char error_string_response[512];
-
-	logmode = config->logmode;
-	logfile = config->logfile;
+	struct log_entry *entry = malloc(sizeof(struct log_entry));
 
-	if (config->logmode & LOG_MODE_FILE) {
-		log_file_fp = fopen (config->logfile, "a+");
-		if (log_file_fp == 0) {
-			sprintf (error_string_response,
-				"Can't open logfile '%s' for reason (%s).\n",
-					 config->logfile, strerror (errno));
-			*error_string = error_string_response;
-			return (-1);
-		}
+	entry->file = file;
+	entry->line = line;
+	entry->level = level;
+	entry->next = NULL;
+	if (head == NULL) {
+		head = tail = entry;
+	} else {
+		tail->next = entry;
+		tail = entry;
 	}
-
-	for (i = 0; i < config->loggers; i++) {
-		if (config->logger[i].level == 0)
-			config->logger[i].level = LOG_LEVEL_INFO;
-		config->logger[i].tags |= TAG_LOG;
-		logger_init (config->logger[i].ident,
-					 config->logger[i].tags,
-					 config->logger[i].level,
-					 config->logger[i].mode);
-	}
-			
-	return (0);
+	vsnprintf(entry->str, sizeof(entry->str), format, ap);
 }
 
-static void _log_printf (char *file, int line, int priority,
-						char *format, va_list ap)
+static void _log_printf (char *file, int line,
+						 int level, int id,
+						 char *format, va_list ap)
 {
 	char newstring[4096];
 	char log_string[4096];
 	char char_time[512];
 	struct timeval tv;
-	int level = LOG_LEVEL(priority);
-	int id = LOG_ID(priority);
 	int i = 0;
+	int len;
 
 	assert (id < MAX_LOGGERS);
 
+	/*
+	** Buffer before log_setup() has been called.
+	*/
+	if (logmode & LOG_MODE_BUFFER) {
+		buffered_log_printf(file, line, level, format, ap);
+		return;
+	}
+
 	if (((logmode & LOG_MODE_FILE) || (logmode & LOG_MODE_STDERR)) &&
 		(logmode & LOG_MODE_TIMESTAMP)) {
 		gettimeofday (&tv, NULL);
@@ -169,7 +164,15 @@ static void _log_printf (char *file, int line, int priority,
 	} else {	
 		sprintf (&newstring[i], "[%-5s] %s", loggers[id].ident, format);
 	}
-	vsprintf (log_string, newstring, ap);
+	len = vsprintf (log_string, newstring, ap);
+
+	/*
+	** add line feed if not done yet
+	*/
+	if (log_string[len - 1] != '\n') {
+		log_string[len] = '\n';
+		log_string[len + 1] = '\0';
+	}
 
 	/*
 	 * Output the log data
@@ -188,10 +191,81 @@ static void _log_printf (char *file, int line, int priority,
 	}
 }
 
+int _log_init (const char *ident)
+{
+	assert (ident != NULL);
+
+	/*
+	** do different things before and after log_setup() has been called
+	*/
+	if (log_setup_called) {
+		return logger_init (ident, TAG_LOG, LOG_LEVEL_INFO, 0);
+	} else {
+		return logger_init (ident, ~0, LOG_LEVEL_DEBUG, 0);
+	}
+}
+
+int log_setup (char **error_string, struct main_config *config)
+{
+	int i;
+	static char error_string_response[512];
+
+	logmode = config->logmode;
+	logfile = config->logfile;
+
+	if (config->logmode & LOG_MODE_FILE) {
+		log_file_fp = fopen (config->logfile, "a+");
+		if (log_file_fp == 0) {
+			sprintf (error_string_response,
+				"Can't open logfile '%s' for reason (%s).\n",
+					 config->logfile, strerror (errno));
+			*error_string = error_string_response;
+			return (-1);
+		}
+	}
+
+	/*
+	** reinit all loggers that has initialised before log_setup() was called.
+	*/
+	for (i = 0; i < MAX_LOGGERS; i++) {
+		loggers[i].tags = TAG_LOG;
+		if (config->logmode & LOG_MODE_DEBUG) {
+			loggers[i].level = LOG_LEVEL_DEBUG;
+		} else {
+			loggers[i].level = LOG_LEVEL_INFO;
+		}
+	}
+
+	/*
+	** init all loggers that has configured level and tags
+	*/
+	for (i = 0; i < config->loggers; i++) {
+		if (config->logger[i].level == 0)
+			config->logger[i].level = LOG_LEVEL_INFO;
+		config->logger[i].tags |= TAG_LOG;
+		logger_init (config->logger[i].ident,
+					 config->logger[i].tags,
+					 config->logger[i].level,
+					 config->logger[i].mode);
+	}
+
+	log_setup_called = 1;
+
+	/*
+	** Flush what we have buffered
+	*/
+	log_flush();
+
+	internal_log_printf(__FILE__, __LINE__, LOG_LEVEL_DEBUG, "log setup\n");
+
+	return (0);
+}
+
 void internal_log_printf (char *file, int line, int priority,
 						  char *format, ...)
 {
 	int id = LOG_ID(priority);
+	int level = LOG_LEVEL(priority);
 	va_list ap;
 
 	assert (id < MAX_LOGGERS);
@@ -201,15 +275,50 @@ void internal_log_printf (char *file, int line, int priority,
 	}
 
 	va_start (ap, format);
-	_log_printf (file, line, priority, format, ap);
+	_log_printf (file, line, level, id, format, ap);
 	va_end(ap);
 }
 
-void internal_log_printf2 (char *file, int line, int priority,
-						  char *format, ...)
+void internal_log_printf2 (char *file, int line, int level, int id,
+						   char *format, ...)
 {
 	va_list ap;
+
+	assert (id < MAX_LOGGERS);
+
 	va_start (ap, format);
-	_log_printf (file, line, priority, format, ap);
+	_log_printf (file, line, level, id, format, ap);
 	va_end(ap);
 }
+
+void trace (char *file, int line, int tag, int id, char *format, ...)
+{
+	assert (id < MAX_LOGGERS);
+
+	if (tag & loggers[id].tags) {
+		va_list ap;
+
+		va_start (ap, format);
+		_log_printf (file, line, LOG_LEVEL_DEBUG, id, format, ap);
+		va_end(ap);
+	}
+}
+
+void log_flush(void)
+{
+	struct log_entry *entry = head;
+	struct log_entry *tmp;
+
+	/* do not buffer these printouts */
+	logmode &= ~LOG_MODE_BUFFER;
+
+	while (entry) {
+		internal_log_printf(entry->file, entry->line,
+							entry->level, entry->str);
+		tmp = entry;
+		entry = entry->next;
+		free(tmp);
+	}
+
+	head = tail = NULL;
+}

+ 70 - 19
exec/print.h

@@ -47,8 +47,9 @@
 #define LOG_MODE_TIMESTAMP	2
 #define LOG_MODE_FILE		4
 #define LOG_MODE_SYSLOG		8
-#define LOG_MODE_STDERR		16
-#define LOG_MODE_FILELINE   32
+#define LOG_MODE_STDERR	   16
+#define LOG_MODE_FILELINE  32
+#define LOG_MODE_BUFFER    64
 
 /*
  * Log levels, compliant with syslog and SA Forum Log spec.
@@ -80,9 +81,9 @@
 
 struct logger {
 	char ident[6];
-	int level;
-	int tags;
-	int mode;
+	unsigned int level;
+	unsigned int tags;
+	unsigned int mode;
 };
 
 extern struct logger loggers[];
@@ -94,7 +95,9 @@ extern struct logger loggers[];
 static int logger_identifier __attribute__((unused));
 
 extern void internal_log_printf (char *file, int line, int priority, char *format, ...);
-extern void internal_log_printf2 (char *file, int line, int priority, char *format, ...);
+extern void internal_log_printf2 (char *file, int line, int level, int id, char *format, ...);
+extern void trace (char *file, int line, int tag, int id, char *format, ...);
+extern void log_flush(void);
 
 #define LEVELMASK 0x07                 /* 3 bits */
 #define LOG_LEVEL(p) ((p) & LEVELMASK)
@@ -118,37 +121,85 @@ static inline void log_init (const char *ident)
 
 #define log_printf(lvl, format, args...) do { \
     if ((lvl) <= loggers[logger_identifier].level)	{ \
-		internal_log_printf2 (__FILE__, __LINE__, _mkpri ((lvl), logger_identifier), format, ##args);  \
+		internal_log_printf2 (__FILE__, __LINE__, lvl, logger_identifier, format, ##args);  \
     } \
 } while(0)
 
 #define dprintf(format, args...) do { \
     if (LOG_LEVEL_DEBUG <= loggers[logger_identifier].level)	{ \
-		internal_log_printf2 (__FILE__, __LINE__, _mkpri (LOG_LEVEL_DEBUG, logger_identifier), format, ##args);  \
+		internal_log_printf2 (__FILE__, __LINE__, LOG_LEVEL_DEBUG, logger_identifier, format, ##args);  \
     } \
 } while(0)
 
-#define ENTER() do { \
-    if ((LOG_LEVEL_DEBUG <= loggers[logger_identifier].level) && (TAG_ENTER & loggers[logger_identifier].tags))	{ \
-        internal_log_printf2 (__FILE__, __LINE__, _mkpri (LOG_LEVEL_DEBUG, logger_identifier), ">%s\n", __FUNCTION__); \
+#define ENTER_VOID() do { \
+    if (LOG_LEVEL_DEBUG <= loggers[logger_identifier].level) { \
+		trace (__FILE__, __LINE__, TAG_ENTER, logger_identifier, ">%s\n", __FUNCTION__); \
     } \
 } while(0)
 
-#define ENTER_ARGS(format, args...) do { \
-    if ((LOG_LEVEL_DEBUG <= loggers[logger_identifier].level) && (TAG_ENTER & loggers[logger_identifier].tags))	{ \
-        internal_log_printf2 (__FILE__, __LINE__, _mkpri (LOG_LEVEL_DEBUG, logger_identifier), ">%s: " format, __FUNCTION__, ##args); \
+#define ENTER(format, args...) do { \
+    if (LOG_LEVEL_DEBUG <= loggers[logger_identifier].level)  { \
+		trace (__FILE__, __LINE__, TAG_ENTER, logger_identifier, ">%s: " format, __FUNCTION__, ##args); \
     } \
 } while(0)
 
-#define LEAVE() do { \
-    if ((LOG_LEVEL_DEBUG <= loggers[logger_identifier].level) && (TAG_LEAVE & loggers[logger_identifier].tags))	{ \
-        internal_log_printf2 (__FILE__, __LINE__, _mkpri (LOG_LEVEL_DEBUG, logger_identifier), "<%s\n", __FUNCTION__); \
+#define LEAVE_VOID() do { \
+    if (LOG_LEVEL_DEBUG <= loggers[logger_identifier].level) { \
+		trace (__FILE__, __LINE__, TAG_LEAVE, logger_identifier, "<%s\n", __FUNCTION__); \
+    } \
+} while(0)
+
+#define LEAVE(format, args...) do { \
+    if (LOG_LEVEL_DEBUG <= loggers[logger_identifier].level)  { \
+		trace (__FILE__, __LINE__, TAG_LEAVE, logger_identifier, ">%s: " format, __FUNCTION__, ##args); \
+    } \
+} while(0)
+
+#define TRACE1(format, args...) do { \
+    if (LOG_LEVEL_DEBUG <= loggers[logger_identifier].level) { \
+		trace (__FILE__, __LINE__, TAG_TRACE1, logger_identifier, format, ##args);  \
+    } \
+} while(0)
+
+#define TRACE2(format, args...) do { \
+    if (LOG_LEVEL_DEBUG <= loggers[logger_identifier].level) { \
+		trace (__FILE__, __LINE__, TAG_TRACE2, logger_identifier, format, ##args);  \
+    } \
+} while(0)
+
+#define TRACE3(format, args...) do { \
+    if (LOG_LEVEL_DEBUG <= loggers[logger_identifier].level) { \
+		trace (__FILE__, __LINE__, TAG_TRACE3, logger_identifier, format, ##args);  \
+    } \
+} while(0)
+
+#define TRACE4(format, args...) do { \
+    if (LOG_LEVEL_DEBUG <= loggers[logger_identifier].level) { \
+		trace (__FILE__, __LINE__, TAG_TRACE4, logger_identifier, format, ##args);  \
+    } \
+} while(0)
+
+#define TRACE5(format, args...) do { \
+    if (LOG_LEVEL_DEBUG <= loggers[logger_identifier].level) { \
+		trace (__FILE__, __LINE__, TAG_TRACE5, logger_identifier, format, ##args);  \
+    } \
+} while(0)
+
+#define TRACE6(format, args...) do { \
+    if (LOG_LEVEL_DEBUG <= loggers[logger_identifier].level) { \
+		trace (__FILE__, __LINE__, TAG_TRACE6, logger_identifier, format, ##args);  \
+    } \
+} while(0)
+
+#define TRACE7(format, args...) do { \
+    if (LOG_LEVEL_DEBUG <= loggers[logger_identifier].level) { \
+		trace (__FILE__, __LINE__, TAG_TRACE7, logger_identifier, format, ##args);  \
     } \
 } while(0)
 
 #define TRACE8(format, args...) do { \
-    if ((LOG_LEVEL_DEBUG <= loggers[logger_identifier].level) && (TAG_TRACE8 & loggers[logger_identifier].tags)) { \
-		internal_log_printf2 (__FILE__, __LINE__, _mkpri (LOG_LEVEL_DEBUG, logger_identifier), format, ##args);  \
+    if (LOG_LEVEL_DEBUG <= loggers[logger_identifier].level) { \
+		trace (__FILE__, __LINE__, TAG_TRACE8, logger_identifier, format, ##args);  \
     } \
 } while(0)
 

+ 0 - 1
exec/service.c

@@ -42,7 +42,6 @@
 #include "service.h"
 #include "mainconfig.h"
 #include "util.h"
-#define LOG_SERVICE LOG_SERVICE_SERV
 #include "print.h"
 
 struct default_service {

+ 0 - 3
exec/sync.c

@@ -56,10 +56,7 @@
 #include "totem.h"
 #include "vsf.h"
 #include "swab.h"
-
 #include "../lcr/lcr_ifact.h"
-
-#define LOG_SERVICE LOG_SERVICE_SYNC
 #include "print.h"
 
 #define MESSAGE_REQ_SYNC_BARRIER 0

+ 0 - 2
exec/totemconfig.c

@@ -53,8 +53,6 @@
 #include "print.h"
 #include "objdb.h"
 
-#define LOG_SERVICE LOG_SERVICE_GMI
-
 #if defined(OPENAIS_BSD) || defined(OPENAIS_DARWIN)
 	#define HZ 100  /* 10ms */
 #endif

+ 1 - 1
exec/util.c

@@ -42,7 +42,6 @@
 #include "../include/list.h"
 #include "aispoll.h"
 #include "util.h"
-#define LOG_SERVICE LOG_SERVICE_MAIN
 #include "print.h"
 
 /*
@@ -79,6 +78,7 @@ SaTimeT clust_time_now(void)
 void openais_exit_error (enum e_ais_done err)
 {
 	log_printf (LOG_LEVEL_ERROR, "AIS Executive exiting (%d).\n", err);
+	log_flush();
 	exit (err);
 }
 

+ 0 - 3
exec/vsf_ykd.c

@@ -58,11 +58,8 @@
 #include "print.h"
 #include "swab.h"
 #include "vsf.h"
-
 #include "../lcr/lcr_comp.h"
 
-#define LOG_SERVICE LOG_SERVICE_YKD
-
 enum ykd_header_values {
 	YKD_HEADER_SENDSTATE = 0,
 	YKD_HEADER_ATTEMPT = 1

+ 42 - 1
man/openais.conf.5

@@ -344,7 +344,7 @@ The default is 17 messages.
 .PP
 Within the 
 .B logging
-directive, there are six configuration options which are all optional:
+directive, there are seven configuration options which are all optional:
 .TP
 to_stderr
 .TP
@@ -373,6 +373,47 @@ The default is off.
 timestamp
 This specifies that a timestamp is placed on all log messages.
 
+The default is off.
+
+.TP
+fileline
+This specifies that file and line should be printed instead of logger name.
+
+The default is off.
+
+.PP
+.PP
+Within the 
+.B logging
+directive, logger directives are optional.
+.PP
+.PP
+Within the 
+.B logger
+sub-directive of logging there are three configuration options:
+
+.TP
+ident
+This specifies the identity (name) for which logging is specified. This directive is required.
+
+.TP
+debug
+This specifies whether debug output is logged for this particular logger.
+
+The default is off.
+
+.TP
+tags
+This specifies which tags should be traced for this particular logger.
+Set debug directive to
+.B on
+in order to enable tracing using tags.
+Values are specified using a vertical bar as a logical OR separator:
+
+enter|return|trace1|trace2|trace3|...
+
+The default is none.
+
 .PP
 Within the 
 .B event