mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
Allow setting the log level (for the error log, not the access log) from the
config file. svn path=/trunk/icecast/; revision=3774
This commit is contained in:
parent
8d75eb0b4a
commit
fce9ecb952
@ -38,6 +38,7 @@
|
||||
<logging>
|
||||
<accesslog>access.log</accesslog>
|
||||
<errorlog>error.log</errorlog>
|
||||
<loglevel>4</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
|
||||
</logging>
|
||||
|
||||
<security>
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define CONFIG_DEFAULT_PORT 8888
|
||||
#define CONFIG_DEFAULT_ACCESS_LOG "access.log"
|
||||
#define CONFIG_DEFAULT_ERROR_LOG "error.log"
|
||||
#define CONFIG_DEFAULT_LOG_LEVEL 4
|
||||
#define CONFIG_DEFAULT_CHROOT 0
|
||||
#define CONFIG_DEFAULT_CHUID 0
|
||||
#define CONFIG_DEFAULT_USER NULL
|
||||
@ -151,6 +152,7 @@ static void _set_defaults(void)
|
||||
_configuration.log_dir = (char *)strdup(CONFIG_DEFAULT_LOG_DIR);
|
||||
_configuration.access_log = (char *)strdup(CONFIG_DEFAULT_ACCESS_LOG);
|
||||
_configuration.error_log = (char *)strdup(CONFIG_DEFAULT_ERROR_LOG);
|
||||
_configuration.loglevel = CONFIG_DEFAULT_LOG_LEVEL;
|
||||
_configuration.chroot = CONFIG_DEFAULT_CHROOT;
|
||||
_configuration.chuid = CONFIG_DEFAULT_CHUID;
|
||||
_configuration.user = CONFIG_DEFAULT_USER;
|
||||
@ -299,6 +301,10 @@ static void _parse_logging(xmlDocPtr doc, xmlNodePtr node)
|
||||
} else if (strcmp(node->name, "errorlog") == 0) {
|
||||
if (_configuration.error_log) free(_configuration.error_log);
|
||||
_configuration.error_log = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
} else if (strcmp(node->name, "loglevel") == 0) {
|
||||
char *tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
_configuration.loglevel = atoi(tmp);
|
||||
if (tmp) free(tmp);
|
||||
}
|
||||
} while ((node = node->next));
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ typedef struct ice_config_tag
|
||||
|
||||
char *access_log;
|
||||
char *error_log;
|
||||
int loglevel;
|
||||
|
||||
int chroot;
|
||||
int chuid;
|
||||
|
@ -107,7 +107,7 @@ static int _start_logging(void)
|
||||
accesslog = log_open_file(stderr);
|
||||
}
|
||||
|
||||
log_set_level(errorlog, 4);
|
||||
log_set_level(errorlog, config->loglevel);
|
||||
log_set_level(accesslog, 4);
|
||||
|
||||
if (errorlog < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user