]> git.proxmox.com Git - mirror_corosync.git/commitdiff
Add logging configuration backward compatibility layer
authorFabio M. Di Nitto <fdinitto@redhat.com>
Tue, 21 Apr 2009 04:37:28 +0000 (04:37 +0000)
committerFabio M. Di Nitto <fdinitto@redhat.com>
Tue, 21 Apr 2009 04:37:28 +0000 (04:37 +0000)
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2102 fd59a12c-fef9-0310-b244-a6a79926bd2f

exec/mainconfig.c

index 7152ee74f506419264fa2a0181e3cf76fb691beb..135e43e87143f5806948d05c9ce53db89ec5f741 100644 (file)
@@ -285,6 +285,31 @@ static int corosync_main_config_set (
                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 @@ static int corosync_main_config_set (
                                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 @@ static int corosync_main_config_set (
                }
        }
 
+       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;