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

send errorlog (loglevel WARN) to stderr prior to opening the real logfiles. closes #1886

svn path=/icecast/trunk/icecast/; revision=19271
This commit is contained in:
Philipp Schafft 2014-11-07 11:18:54 +00:00
parent 1d56769648
commit 0b7e65c3c9

View File

@ -200,6 +200,16 @@ static int _parse_config_opts(int argc, char **argv, char *filename, int size)
return -1;
}
static int _start_logging_stdout(void) {
errorlog = log_open_file(stderr);
if ( errorlog < 0 )
return 0;
log_set_level(errorlog, 2 /* WARN */);
return 1;
}
static int _start_logging(void)
{
char fn_error[FILENAME_MAX];
@ -218,8 +228,7 @@ static int _start_logging(void)
log_set_trigger (errorlog, config->logsize);
log_set_archive_timestamp(errorlog, config->logarchive);
} else {
errorlog = log_open_file(stderr);
log_to_stderr = 1;
/* this is already in place because of _start_logging_stdout() */
}
if (errorlog < 0) {
@ -434,6 +443,11 @@ int main(int argc, char **argv)
#if !defined(_WIN32) || defined(_CONSOLE) || defined(__MINGW32__) || defined(__MINGW64__)
/* startup all the modules */
initialize_subsystems();
if (!_start_logging_stdout()) {
_fatal_error("FATAL: Could not start logging on stderr.");
shutdown_subsystems();
return 1;
}
#endif
/* parse the config file */
config_get_config();