[Freeswitch-svn] [commit] r9031 - in freeswitch/trunk: conf/autoload_configs src/mod/loggers/mod_syslog

Freeswitch SVN mikej at freeswitch.org
Tue Jul 15 00:02:24 EDT 2008


Author: mikej
Date: Tue Jul 15 00:02:24 2008
New Revision: 9031

Modified:
   freeswitch/trunk/conf/autoload_configs/syslog.conf.xml
   freeswitch/trunk/src/mod/loggers/mod_syslog/mod_syslog.c

Log:
tweak to make mod_syslog work again (FSCORE-153)

Modified: freeswitch/trunk/conf/autoload_configs/syslog.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/syslog.conf.xml	(original)
+++ freeswitch/trunk/conf/autoload_configs/syslog.conf.xml	Tue Jul 15 00:02:24 2008
@@ -10,6 +10,6 @@
   <!-- debug   - debug-level message -->
   <settings>
     <param name="ident" value="freeswitch"/>
-    <param name="format" value="${time} - ${message}"/>
+    <param name="loglevel" value="warning"/>
   </settings>
 </configuration>

Modified: freeswitch/trunk/src/mod/loggers/mod_syslog/mod_syslog.c
==============================================================================
--- freeswitch/trunk/src/mod/loggers/mod_syslog/mod_syslog.c	(original)
+++ freeswitch/trunk/src/mod/loggers/mod_syslog/mod_syslog.c	Tue Jul 15 00:02:24 2008
@@ -44,6 +44,7 @@
 SWITCH_MODULE_DEFINITION(mod_syslog, mod_syslog_load, mod_syslog_shutdown, NULL);
 
 static switch_status_t load_config(void);
+static switch_log_level_t log_level;
 
 static struct {
 	char *ident;
@@ -68,7 +69,6 @@
 
 static switch_status_t mod_syslog_logger(const switch_log_node_t *node, switch_log_level_t level)
 {
-	char *message = NULL;
 	int syslog_level;
 
 	switch (level) {
@@ -98,7 +98,7 @@
 		break;
 	}
 
-	if (!switch_strlen_zero(message)) {
+	if (!switch_strlen_zero(node->data)) {
 		syslog(syslog_level, "%s", node->data);
 	}
 
@@ -111,6 +111,9 @@
 {
 	char *cf = "syslog.conf";
 	switch_xml_t cfg, xml, settings, param;
+    
+    /* default log level */
+    log_level = SWITCH_LOG_WARNING;
 
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
@@ -124,7 +127,13 @@
 					set_global_ident(val);
 				} else if (!strcmp(var, "format")) {
 					set_global_format(val);
-				}
+                } else if (!strcasecmp(var, "loglevel") && !switch_strlen_zero(val)) {
+                    log_level = switch_log_str2level(val);
+                    if(log_level == SWITCH_LOG_INVALID)
+                    {
+                        log_level = SWITCH_LOG_WARNING;
+                    }
+                }
 
 			}
 		}
@@ -152,7 +161,8 @@
 
 	openlog(globals.ident, LOG_PID, LOG_USER);
 
-	switch_log_bind_logger(mod_syslog_logger, SWITCH_LOG_DEBUG, SWITCH_FALSE);
+	setlogmask(LOG_UPTO(LOG_DEBUG));
+	switch_log_bind_logger(mod_syslog_logger, log_level, SWITCH_FALSE);
 
 	return SWITCH_STATUS_SUCCESS;
 }



More information about the Freeswitch-svn mailing list