Allow the syslog facility type to be set in the configuration file.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1029 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Patrick Caulfield 2006-05-19 07:36:49 +00:00
parent 8a55ef585e
commit 1948867924
4 changed files with 49 additions and 0 deletions

View File

@ -167,6 +167,39 @@ int openais_main_config_read (
}
}
if (!objdb_get_string (objdb,object_service_handle, "syslog_facility", &value)) {
if (strcmp (value, "daemon") == 0) {
main_config->syslog_facility = LOG_DAEMON;
} else
if (strcmp (value, "local0") == 0) {
main_config->syslog_facility = LOG_LOCAL0;
} else
if (strcmp (value, "local1") == 0) {
main_config->syslog_facility = LOG_LOCAL1;
} else
if (strcmp (value, "local2") == 0) {
main_config->syslog_facility = LOG_LOCAL2;
} else
if (strcmp (value, "local3") == 0) {
main_config->syslog_facility = LOG_LOCAL3;
} else
if (strcmp (value, "local4") == 0) {
main_config->syslog_facility = LOG_LOCAL4;
} else
if (strcmp (value, "local5") == 0) {
main_config->syslog_facility = LOG_LOCAL5;
} else
if (strcmp (value, "local6") == 0) {
main_config->syslog_facility = LOG_LOCAL6;
} else
if (strcmp (value, "local7") == 0) {
main_config->syslog_facility = LOG_LOCAL7;
} else {
error_reason = "unknown syslog facility specified";
goto parse_error;
}
}
while ( objdb->object_find (object_service_handle,
"logger",
strlen ("logger"),
@ -258,6 +291,9 @@ int openais_main_config_read (
goto parse_error;
}
if (!main_config->syslog_facility)
main_config->syslog_facility = LOG_DAEMON;
return 0;
parse_error:

View File

@ -66,6 +66,7 @@ struct main_config {
*/
int logmode;
char *logfile;
int syslog_facility;
/* user/group to run as */
char *user;

View File

@ -224,6 +224,10 @@ int log_setup (char **error_string, struct main_config *config)
}
}
if (config->logmode & LOG_MODE_SYSLOG) {
openlog("openais", LOG_CONS|LOG_PID, config->syslog_facility);
}
/*
** reinit all loggers that has initialised before log_setup() was called.
*/

View File

@ -381,6 +381,14 @@ This specifies that file and line should be printed instead of logger name.
The default is off.
.TP
syslog_facility
This specifies the syslog facility type that will be used for any messages
sent to syslog. options are daemon, local0, local1, local2, local3, local4,
local5, local6 & local7.
The default is daemon.
.PP
.PP
Within the