1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

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
This commit is contained in:
Karl Heyes 2005-08-16 16:56:24 +00:00
parent ab8e36bd19
commit 092c73b4a5
4 changed files with 19 additions and 0 deletions

View File

@ -35,6 +35,7 @@ void event_config_read(void *arg)
config = config_grab_config(); /* Both to get the lock, and to be able config = config_grab_config(); /* Both to get the lock, and to be able
to find out the config filename */ to find out the config filename */
xmlSetGenericErrorFunc ("config", log_parse_failure);
ret = config_parse_file(config->config_filename, &new_config); ret = config_parse_file(config->config_filename, &new_config);
if(ret < 0) { if(ret < 0) {
ERROR0("Error parsing config, not replacing existing config"); ERROR0("Error parsing config, not replacing existing config");

View File

@ -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) void restart_logging (ice_config_t *config)
{ {

View File

@ -95,6 +95,7 @@ extern int playlistlog;
void logging_access(client_t *client); void logging_access(client_t *client);
void logging_playlist(const char *mount, const char *metadata, long listeners); void logging_playlist(const char *mount, const char *metadata, long listeners);
void restart_logging (ice_config_t *config); void restart_logging (ice_config_t *config);
void log_parse_failure (void *ctx, const char *fmt, ...);
#endif /* __LOGGING_H__ */ #endif /* __LOGGING_H__ */

View File

@ -190,6 +190,9 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
xmlChar *string; xmlChar *string;
int len, problem = 0; int len, problem = 0;
xmlSetGenericErrorFunc ("", log_parse_failure);
xsltSetGenericErrorFunc ("", log_parse_failure);
thread_mutex_lock(&xsltlock); thread_mutex_lock(&xsltlock);
cur = xslt_get_stylesheet(xslfilename); cur = xslt_get_stylesheet(xslfilename);