Hi guys,

in order to match the new logging config spec, 2 logging config keywords
had to be changed.

The following patch adds the old keywords as compatibility layer and
also add a warning that the config keyword has been obsoleted.

If both old and new keyword are present, the new one is preferred by
overriding the value of the old one.

Fabio
Index: exec/mainconfig.c
===================================================================
--- exec/mainconfig.c	(revision 2100)
+++ exec/mainconfig.c	(working copy)
@@ -285,6 +285,31 @@
 		goto parse_error;
 	}
 
+	if (!objdb_get_string (objdb,object_handle, "to_file", &value)) {
+
+		log_printf(LOGSYS_LEVEL_WARNING,
+		 "Warning: the to_file config paramater has been obsoleted."
+		 " See corosync.conf man page to_logfile directive.");
+
+		if (strcmp (value, "yes") == 0) {
+			mode |= LOGSYS_MODE_OUTPUT_FILE;
+			if (logsys_config_mode_set(subsys, mode) < 0) {
+				error_reason = "unable to set mode to_file";
+				goto parse_error;
+			}
+		} else
+		if (strcmp (value, "no") == 0) {
+			mode &= ~LOGSYS_MODE_OUTPUT_FILE;
+			if (logsys_config_mode_set(subsys, mode) < 0) {
+				error_reason = "unable to unset mode to_file";
+				goto parse_error;
+			}
+		} else {
+			error_reason = "unknown value for to_file";
+			goto parse_error;
+		}
+	}
+
 	if (!objdb_get_string (objdb,object_handle, "to_logfile", &value)) {
 		if (strcmp (value, "yes") == 0) {
 			mode |= LOGSYS_MODE_OUTPUT_FILE;
@@ -300,7 +325,7 @@
 				goto parse_error;
 			}
 		} else {
-			error_reason = "unknown value for to_file";
+			error_reason = "unknown value for to_logfile";
 			goto parse_error;
 		}
 	}
@@ -360,6 +385,25 @@
 		}
 	}
 
+	if (!objdb_get_string (objdb,object_handle, "syslog_level", &value)) {
+		int syslog_priority;
+
+		log_printf(LOGSYS_LEVEL_WARNING,
+		 "Warning: the syslog_level config paramater has been obsoleted."
+		 " See corosync.conf man page syslog_priority directive.");
+
+		syslog_priority = logsys_priority_id_get(value);
+		if (syslog_priority < 0) {
+			error_reason = "unknown syslog level specified";
+			goto parse_error;
+		}
+		if (logsys_config_syslog_priority_set(subsys,
+						syslog_priority) < 0) {
+			error_reason = "unable to set syslog level";
+			goto parse_error;
+		}
+	}
+
 	if (!objdb_get_string (objdb,object_handle, "syslog_priority", &value)) {
 		int syslog_priority;
 
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to