- 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
This commit is contained in:
Hans Feldt 2006-05-03 08:45:44 +00:00
parent e92a77598b
commit 905ba3b406
20 changed files with 329 additions and 147 deletions

View File

@ -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();
}

View File

@ -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

View File

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

View File

@ -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
};

View File

@ -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

View File

@ -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 (

View File

@ -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);

View File

@ -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
*/

View File

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

View File

@ -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

View File

@ -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, "|");

View File

@ -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 {

View File

@ -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,11 +112,97 @@ static int logger_init (const char *ident, int tags, int level, int mode)
return i;
}
static void buffered_log_printf (char *file, int line, int level,
char *format, va_list ap)
{
struct log_entry *entry = malloc(sizeof(struct log_entry));
entry->file = file;
entry->line = line;
entry->level = level;
entry->next = NULL;
if (head == NULL) {
head = tail = entry;
} else {
tail->next = entry;
tail = entry;
}
vsnprintf(entry->str, sizeof(entry->str), format, 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 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);
strftime (char_time, sizeof (char_time), "%b %e %k:%M:%S",
localtime (&tv.tv_sec));
i = sprintf (newstring, "%s.%06ld ", char_time, (long)tv.tv_usec);
}
if ((level == LOG_LEVEL_DEBUG) || (logmode & LOG_MODE_FILELINE)) {
sprintf (&newstring[i], "[%s:%u] %s", file, line, format);
} else {
sprintf (&newstring[i], "[%-5s] %s", loggers[id].ident, format);
}
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
*/
if (logmode & LOG_MODE_FILE && log_file_fp != 0) {
fprintf (log_file_fp, "%s", log_string);
fflush (log_file_fp);
}
if (logmode & LOG_MODE_STDERR) {
fprintf (stderr, "%s", log_string);
}
fflush (stdout);
if (logmode & LOG_MODE_SYSLOG) {
syslog (level, &log_string[i]);
}
}
int _log_init (const char *ident)
{
assert (ident != NULL);
return logger_init (ident, TAG_LOG, LOG_LEVEL_INFO, 0);
/*
** 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)
@ -130,6 +224,21 @@ int log_setup (char **error_string, struct main_config *config)
}
}
/*
** 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;
@ -139,59 +248,24 @@ int log_setup (char **error_string, struct main_config *config)
config->logger[i].level,
config->logger[i].mode);
}
return (0);
}
static void _log_printf (char *file, int line, int priority,
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;
assert (id < MAX_LOGGERS);
if (((logmode & LOG_MODE_FILE) || (logmode & LOG_MODE_STDERR)) &&
(logmode & LOG_MODE_TIMESTAMP)) {
gettimeofday (&tv, NULL);
strftime (char_time, sizeof (char_time), "%b %e %k:%M:%S",
localtime (&tv.tv_sec));
i = sprintf (newstring, "%s.%06ld ", char_time, (long)tv.tv_usec);
}
if ((level == LOG_LEVEL_DEBUG) || (logmode & LOG_MODE_FILELINE)) {
sprintf (&newstring[i], "[%s:%u] %s", file, line, format);
} else {
sprintf (&newstring[i], "[%-5s] %s", loggers[id].ident, format);
}
vsprintf (log_string, newstring, ap);
log_setup_called = 1;
/*
* Output the log data
*/
if (logmode & LOG_MODE_FILE && log_file_fp != 0) {
fprintf (log_file_fp, "%s", log_string);
fflush (log_file_fp);
}
if (logmode & LOG_MODE_STDERR) {
fprintf (stderr, "%s", log_string);
}
fflush (stdout);
** Flush what we have buffered
*/
log_flush();
if (logmode & LOG_MODE_SYSLOG) {
syslog (level, &log_string[i]);
}
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;
}

View File

@ -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)

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -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