diff --git a/exec/logsys.h b/exec/logsys.h index 3bcfcf0d..b10cbcee 100644 --- a/exec/logsys.h +++ b/exec/logsys.h @@ -50,9 +50,8 @@ #define LOG_MODE_DISPLAY_PRIORITY (1<<5) #define LOG_MODE_DISPLAY_FILELINE (1<<6) #define LOG_MODE_DISPLAY_TIMESTAMP (1<<7) -#define LOG_MODE_DISPLAY_DEBUG (1<<8) -#define LOG_MODE_BUFFER_BEFORE_CONFIG (1<<9) -#define LOG_MODE_FLUSH_AFTER_CONFIG (1<<10) +#define LOG_MODE_BUFFER_BEFORE_CONFIG (1<<8) +#define LOG_MODE_FLUSH_AFTER_CONFIG (1<<9) /* * Log priorities, compliant with syslog and SA Forum Log spec. diff --git a/exec/main.c b/exec/main.c index 2ff42a19..aac265a1 100644 --- a/exec/main.c +++ b/exec/main.c @@ -83,7 +83,7 @@ #include "version.h" LOGSYS_DECLARE_SYSTEM ("openais", - LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_DISPLAY_DEBUG | LOG_MODE_BUFFER_BEFORE_CONFIG, + LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_BUFFER_BEFORE_CONFIG, NULL, LOG_DAEMON); diff --git a/exec/mainconfig.c b/exec/mainconfig.c index fda017f8..31f99b73 100644 --- a/exec/mainconfig.c +++ b/exec/mainconfig.c @@ -106,6 +106,7 @@ int openais_main_config_read ( unsigned int object_logger_subsys_handle; char *value; char *error_reason = error_string_response; + int global_debug = 0; memset (main_config, 0, sizeof (struct main_config)); @@ -145,10 +146,10 @@ int openais_main_config_read ( if (!objdb_get_string (objdb,object_service_handle, "debug", &value)) { if (strcmp (value, "on") == 0) { - main_config->logmode |= LOG_MODE_DISPLAY_DEBUG; + global_debug = 1; } else if (strcmp (value, "off") == 0) { - main_config->logmode &= ~LOG_MODE_DISPLAY_DEBUG; + global_debug = 0; } else { goto parse_error; } @@ -212,6 +213,11 @@ int openais_main_config_read ( goto parse_error; } } + else { + if (global_debug) + logsys_logger.priority = LOG_LEVEL_DEBUG; + } + if (!objdb_get_string (objdb, object_logger_subsys_handle, "tags", &value)) { char *token = strtok (value, "|"); diff --git a/man/logsys_overview.8 b/man/logsys_overview.8 index f2f64c8b..f7b2564e 100644 --- a/man/logsys_overview.8 +++ b/man/logsys_overview.8 @@ -70,7 +70,6 @@ LOG_MODE_OUTPUT_SYSLOG_BLOCKING: Output all log data without using a thread and LOG_MODE_DISPLAY_PRIORITY: Output the priority of the log entry in the message contents. This mode is currently not implemented. LOG_MODE_DISPLAY_FILELINE: Output the file and line at which the log message was created. LOG_MODE_DISPLAY_TIMESTAMP: Output the timestamp of the message. -LOG_MODE_DISPLAY_DEBUG: Display debug level messages LOG_MODE_BUFFER_BEFORE_CONFIG: This mode is used to buffer log messages before logsys_mode_config is called. This is useful in applications in which the logging file isn't known before the application is compiled and must be set dynamically. It is also useful when an application calls fork to disconnect the local tty and should hold logging of messages until after the fork. LOG_MODE_FLUSH_AFTER_CONFIG: This mode is used to flush any buffered messages when the LOG_MODE_BUFFER_BEFORE_CONFIG declartion is specified in the declartion of the logger. The file parameter specifies the filename that should be used to log messages. This parameter may be NULL if LOG_MODE_OUTPUT_FILE is not specified. diff --git a/test/logsys_t1.c b/test/logsys_t1.c index a74aef0a..60c664fe 100644 --- a/test/logsys_t1.c +++ b/test/logsys_t1.c @@ -36,7 +36,7 @@ #include "../exec/logsys.h" LOGSYS_DECLARE_SYSTEM ("logsystestNOsubsystems", - LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_DISPLAY_DEBUG, + LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED, NULL, LOG_DAEMON); diff --git a/test/logsys_t2.c b/test/logsys_t2.c index d8d28a7d..9b92ffa9 100644 --- a/test/logsys_t2.c +++ b/test/logsys_t2.c @@ -36,7 +36,7 @@ #include "../exec/logsys.h" LOGSYS_DECLARE_SYSTEM ("logtest_t2", - LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_DISPLAY_DEBUG | LOG_MODE_BUFFER_BEFORE_CONFIG, + LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_BUFFER_BEFORE_CONFIG, NULL, LOG_DAEMON); @@ -48,7 +48,7 @@ main(int argc, char **argv) /* * fork could occur here and the file to output to could be set */ - logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_DISPLAY_DEBUG | LOG_MODE_FLUSH_AFTER_CONFIG); + logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_FLUSH_AFTER_CONFIG); log_printf(LOG_NOTICE, "Hello, world!\n"); log_printf(LOG_DEBUG, "If you see this, the logger's busted\n"); @@ -68,7 +68,7 @@ main(int argc, char **argv) log_printf(LOG_DEBUG, "Debug 1\n"); - logsys_config_mode_set (LOG_MODE_DISPLAY_DEBUG | LOG_MODE_OUTPUT_STDERR); + logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR); log_printf(LOG_DEBUG, "Debug 2\n");