[icinga-checkins] icinga.org: icinga-core/master: Revert " value 2 for use_syslog will turn off logfile"

git at icinga.org git at icinga.org
Mon Sep 20 09:53:38 CEST 2010


Module: icinga-core
Branch: master
Commit: 336c6bdc0bb6da475e3b3fd94b04908da97fd9a3
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=336c6bdc0bb6da475e3b3fd94b04908da97fd9a3

Author: Christoph Maser <cmr at financial.com>
Date:   Fri Jul 30 22:24:25 2010 +0200

Revert "value 2 for use_syslog will turn off logfile"

This reverts commit 5effc34132acd5753d52efe2f5194b7847bfd2b2.

Conflicts:

	base/config.c

---

 base/config.c    |    4 ++--
 base/logging.c   |   17 +++++------------
 include/icinga.h |    2 +-
 3 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/base/config.c b/base/config.c
index 0c154d2..104853d 100644
--- a/base/config.c
+++ b/base/config.c
@@ -516,13 +516,13 @@ int read_main_config_file(char *main_config_file){
 
 		else if(!strcmp(variable,"use_syslog")){
 
-			if(strlen(value)!=1||value[0]<'0'||value[0]>'2'){
+			if(strlen(value)!=1||value[0]<'0'||value[0]>'1'){
 				asprintf(&error_message,"Illegal value for use_syslog");
 				error=TRUE;
 				break;
 				}
 
-			use_syslog=atoi(value);
+			use_syslog=(atoi(value)>0)?TRUE:FALSE;
 			}
 
 		else if(!strcmp(variable,"use_syslog_local_facility")){
diff --git a/base/logging.c b/base/logging.c
index 261e78d..dd47419 100644
--- a/base/logging.c
+++ b/base/logging.c
@@ -123,14 +123,11 @@ void logit(int data_type, int display, const char *fmt, ...){
 int write_to_all_logs(char *buffer, unsigned long data_type){
 
 	/* write to syslog */
-        if(use_syslog) {
-		write_to_syslog(buffer,data_type);
-	}
+	write_to_syslog(buffer,data_type);
 
 	/* write to main log */
-	if(use_syslog != 2) {
-		write_to_log(buffer,data_type,NULL);
-	}
+	write_to_log(buffer,data_type,NULL);
+
 	return OK;
         }
 
@@ -139,14 +136,10 @@ int write_to_all_logs(char *buffer, unsigned long data_type){
 static void write_to_all_logs_with_timestamp(char *buffer, unsigned long data_type, time_t *timestamp){
 
 	/* write to syslog */
-	if(use_syslog) {
-		write_to_syslog(buffer,data_type);
-	}
+	write_to_syslog(buffer,data_type);
 
 	/* write to main log */
-	if(use_syslog != 2) {
-		write_to_log(buffer,data_type,timestamp);
-	}
+	write_to_log(buffer,data_type,timestamp);
 }
 
 
diff --git a/include/icinga.h b/include/icinga.h
index 08b80f8..b63265c 100644
--- a/include/icinga.h
+++ b/include/icinga.h
@@ -52,7 +52,7 @@ extern "C" {
 /******************* DEFAULT VALUES *******************/
 
 #define DEFAULT_LOG_LEVEL					1	/* log all events to main log file */
-#define DEFAULT_USE_SYSLOG					1	/* log events to syslog? 0=no 1=yes 2=sylog only */
+#define DEFAULT_USE_SYSLOG					1	/* log events to syslog? 1=yes, 0=no */
 #define DEFAULT_USE_SYSLOG_LOCAL_FACILITY			0	/* log events to a local facility instead of the default? 1=yes, 0=no */
 #define DEFAULT_SYSLOG_LOCAL_FACILITY				5	/* log events to the specified loacl facility? 1=yes, 0=no */
 





More information about the icinga-checkins mailing list