]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_logfile code/default config cleanup
authorMichael Jerris <mike@jerris.com>
Tue, 4 Dec 2007 23:06:39 +0000 (23:06 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 4 Dec 2007 23:06:39 +0000 (23:06 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6507 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/autoload_configs/logfile.conf.xml
src/mod/loggers/mod_logfile/mod_logfile.c

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