<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>
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
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
return SWITCH_STATUS_SUCCESS;\r
}\r
\r
-\r
/* rotate the log file */\r
static switch_status_t mod_logfile_rotate(void)\r
{\r
}\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
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
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