git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5782 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-10-03 01:03:10 +00:00
parent 87266aa3ce
commit 92a7c5baf7
2 changed files with 27 additions and 17 deletions

View File

@ -12,13 +12,13 @@
<!-- delay between retries in seconds, default is 5 seconds --> <!-- delay between retries in seconds, default is 5 seconds -->
<!-- <param name="delay" value="1"/> --> <!-- <param name="delay" value="1"/> -->
<!-- optional: full path to the error log dir for failed web posts if not specified its <freeswitch>/logs/xml_cdr_curl -->
<!-- <param name="errLogDir" value="/tmp"/> -->
<!-- optional: if not present we do not log every record to disk --> <!-- optional: if not present we do not log every record to disk -->
<!-- per original code base /xml_cdr is appended to the directory name --> <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank value will default to ${prefix}/logs/xml_cdr -->
<!-- defined but blank value will default to freeswitchdir/log --> <param name="log-dir" value=""/>
<param name="logDir" value=""/>
<!-- optional: full path to the error log dir for failed web posts if not specified its the same as log-dir -->
<!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank or omitted value will default to ${prefix}/logs/xml_cdr -->
<!-- <param name="err-log-dir" value="/tmp"/> -->
</settings> </settings>
</configuration> </configuration>

View File

@ -230,9 +230,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
return SWITCH_STATUS_TERM; return SWITCH_STATUS_TERM;
} }
globals.log_dir = switch_mprintf("%s/xml_cdr", SWITCH_GLOBAL_dirs.log_dir);
globals.err_log_dir = strdup(globals.log_dir);
if ((settings = switch_xml_child(cfg, "settings"))) { if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) { for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name"); char *var = (char *) switch_xml_attr_soft(param, "name");
@ -247,21 +244,34 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
} else if (!strcasecmp(var, "retries")) { } else if (!strcasecmp(var, "retries")) {
globals.retries = (uint32_t) atoi(val); globals.retries = (uint32_t) atoi(val);
} else if (!strcasecmp(var, "log-dir")) { } else if (!strcasecmp(var, "log-dir")) {
switch_safe_free(globals.log_dir); if (switch_strlen_zero(val)) {
globals.log_dir = switch_mprintf("%s/xml_cdr", SWITCH_GLOBAL_dirs.log_dir);
} else {
if (switch_is_file_path(val)) { if (switch_is_file_path(val)) {
globals.log_dir = strdup(val); globals.log_dir = strdup(val);
} else { } else {
globals.log_dir = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.log_dir, val); globals.log_dir = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.log_dir, val);
} }
}
} else if (!strcasecmp(var, "err-log-dir")) { } else if (!strcasecmp(var, "err-log-dir")) {
switch_safe_free(globals.err_log_dir); if (switch_strlen_zero(val)) {
globals.err_log_dir = switch_mprintf("%s/xml_cdr", SWITCH_GLOBAL_dirs.log_dir);
} else {
if (switch_is_file_path(val)) { if (switch_is_file_path(val)) {
globals.err_log_dir = strdup(val); globals.err_log_dir = strdup(val);
} else { } else {
globals.err_log_dir = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.log_dir, val); globals.err_log_dir = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.log_dir, val);
} }
} }
}
if (switch_strlen_zero(globals.err_log_dir)) {
if (!switch_strlen_zero(globals.log_dir)) {
globals.err_log_dir = strdup(globals.log_dir);
} else {
globals.err_log_dir = switch_mprintf("%s/xml_cdr", SWITCH_GLOBAL_dirs.log_dir);
}
}
} }
} }
if(globals.retries < 0) { if(globals.retries < 0) {