[Freeswitch-trunk] [commit] r6507 - in freeswitch/trunk: conf/autoload_configs src/mod/loggers/mod_logfile

Freeswitch SVN mikej at freeswitch.org
Tue Dec 4 18:06:39 EST 2007


Author: mikej
Date: Tue Dec  4 18:06:39 2007
New Revision: 6507

Modified:
   freeswitch/trunk/conf/autoload_configs/logfile.conf.xml
   freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c

Log:
mod_logfile code/default config cleanup

Modified: freeswitch/trunk/conf/autoload_configs/logfile.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/logfile.conf.xml	(original)
+++ freeswitch/trunk/conf/autoload_configs/logfile.conf.xml	Tue Dec  4 18:06:39 2007
@@ -1,15 +1,12 @@
 <configuration name="logfile.conf" description="File Logging">
   <settings>
    <!-- File to log to -->
-   <param name="logfile" value="/var/log/freeswitch.log"/>
+   <!--<param name="logfile" value="/var/log/freeswitch.log"/>-->
    <!-- At this length in bytes rotate the log file -->
-   <param name="rollover" value="12000"/>
+   <!--<param name="rollover" value="10485760"/>-->
    <!-- The level of the message to log -->
    <!--<param name="level" value="debug,info,warning,notice,error,crit,alert"/>-->
-    <param name="level" value="all"/>
-    <!-- Format of the log messages -->
-  <!-- ${time} ${file} ${func} ${message} -->
-  <param name="format"   value="${time} ${file} ${func} ${message}"/>  
+   <param name="level" value="all"/>
 </settings>
 </configuration>
 

Modified: freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c
==============================================================================
--- freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c	(original)
+++ freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c	Tue Dec  4 18:06:39 2007
@@ -36,8 +36,7 @@
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_logfile_shutdown);
 SWITCH_MODULE_DEFINITION(mod_logfile, mod_logfile_load, mod_logfile_shutdown, NULL);
 
-#define DEFAULT_FORMAT   "${data}" 
-#define DEFAULT_LIMIT    0x7FFFFFFF
+#define DEFAULT_LIMIT    0xA00000 /* About 10 MB */
 #define WARM_FUZZY_OFFSET 256
 #define MAX_ROT 4096 /* why not */
 static const uint8_t STATIC_LEVELS[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
@@ -50,12 +49,10 @@
 	switch_size_t log_size;   /* keep the log size in check for rotation */
 	switch_size_t roll_size;  /* the size that we want to rotate the file at */
 	char *logfile;
-	char *format;
 	switch_file_t    *log_afd;
 } globals;
 
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_logfile, globals.logfile);
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_format, globals.format);
 
 /* i know this is strange but it's the fastest way i could think of managing log levels. */
 /* i'd rather not try to search something each time we get a message to log */
@@ -136,7 +133,6 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
 /* rotate the log file */
 static switch_status_t mod_logfile_rotate(void)
 {
@@ -179,41 +175,12 @@
 	}
 
 	free(p);
-    
 
     switch_core_destroy_memory_pool(&pool);
 
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
-#if 0
-/* write to the actual logfile */
-static switch_status_t mod_logfile_write(char *fmt, ...) 
-{
-	char *log_data;
-	switch_status_t stat;
-	switch_size_t len;
-	va_list args;
-	va_start(args, fmt);
-
-	len = switch_vasprintf(&log_data, fmt, args);
-
-	if (len <= 0)
-		return SWITCH_STATUS_FALSE;
-
-	stat = switch_file_write(globals.log_afd, log_data, &len);
-
-	globals.log_size += len;
-
-	if (globals.log_size >= globals.roll_size) {
-		mod_logfile_rotate();
-	}
-
-	return SWITCH_STATUS_SUCCESS;
-}
-#endif
-
 /* write to the actual logfile */
 static switch_status_t mod_logfile_raw_write(char *log_data) 
 {
@@ -261,8 +228,6 @@
 				char *val = (char *) switch_xml_attr_soft(param, "value");
 				if (!strcmp(var, "logfile")) {
 					set_global_logfile(val);
-				} else if (!strcmp(var, "format")) {
-					set_global_format(val);
 				} else if (!strcmp(var, "level")) {
 					process_levels(val);
 				} else if (!strcmp(var, "rollover")) {
@@ -280,9 +245,7 @@
 		snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch.log");
 		set_global_logfile(logfile);
 	}
-	if (switch_strlen_zero(globals.format)) {
-		set_global_format(DEFAULT_FORMAT);
-	}
+
 	return 0;
 }
 



More information about the Freeswitch-trunk mailing list