Commit 092c73b4 authored by Karl Heyes's avatar Karl Heyes

log xml/xslt parsing failure messages via error log. This applies to both the

xsl files and the icecast xml file when re-read. At icecast startup, the logs
are not open so these parsing messages still go to stderr.

svn path=/icecast/trunk/icecast/; revision=9758
parent ab8e36bd
......@@ -35,6 +35,7 @@ void event_config_read(void *arg)
config = config_grab_config(); /* Both to get the lock, and to be able
to find out the config filename */
xmlSetGenericErrorFunc ("config", log_parse_failure);
ret = config_parse_file(config->config_filename, &new_config);
if(ret < 0) {
ERROR0("Error parsing config, not replacing existing config");
......
......@@ -188,6 +188,20 @@ void logging_playlist(const char *mount, const char *metadata, long listeners)
}
void log_parse_failure (void *ctx, const char *fmt, ...)
{
char line [200];
va_list ap;
char *eol;
va_start (ap, fmt);
vsnprintf (line, sizeof (line), fmt, ap);
eol = strrchr (line, '\n');
if (eol) *eol='\0';
va_end (ap);
log_write (errorlog, 2, (char*)ctx, "", "%s", line);
}
void restart_logging (ice_config_t *config)
{
......
......@@ -95,6 +95,7 @@ extern int playlistlog;
void logging_access(client_t *client);
void logging_playlist(const char *mount, const char *metadata, long listeners);
void restart_logging (ice_config_t *config);
void log_parse_failure (void *ctx, const char *fmt, ...);
#endif /* __LOGGING_H__ */
......@@ -190,6 +190,9 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
xmlChar *string;
int len, problem = 0;
xmlSetGenericErrorFunc ("", log_parse_failure);
xsltSetGenericErrorFunc ("", log_parse_failure);
thread_mutex_lock(&xsltlock);
cur = xslt_get_stylesheet(xslfilename);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment