mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-11-03 04:17:17 -05:00
2 new features to icecast logging:
- logsize : specify in KB the max size of any of icecast log files - logarchive : causes icecast to rename logs with timestamps (for proper archiving) svn path=/icecast/trunk/icecast/; revision=10287
This commit is contained in:
parent
758945ed2d
commit
3a85a143b5
@ -160,6 +160,13 @@
|
||||
<errorlog>error.log</errorlog>
|
||||
<!-- <playlistlog>playlist.log</playlistlog> -->
|
||||
<loglevel>4</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
|
||||
<logsize>10000</logsize> <!-- Max size of a logfile -->
|
||||
<!-- If logarchive is enabled (1), then when logsize is reached
|
||||
the logfile will be moved to [error|access|playlist].log.DATESTAMP,
|
||||
otherwise it will be moved to [error|access|playlist].log.old.
|
||||
Default is non-archive mode (i.e. overwrite)
|
||||
-->
|
||||
<!-- <logarchive>1</logarchive> -->
|
||||
</logging>
|
||||
|
||||
<security>
|
||||
|
@ -641,6 +641,18 @@ All icecast generated log messages will be written to this file. If the logleve
|
||||
<div class="indentedbox">
|
||||
Into this file, a log of all metadata for each mountpoint will be written. The format of the logfile will most likely change over time as we narrow in on a standard format for this. Currently, the file is pipe delimited. This option is optional and can be removed entirely from the config file.
|
||||
</div>
|
||||
<h4>logsize</h4>
|
||||
<div class="indentedbox">
|
||||
This value specifies (in Kbytes) the maxmimum size of any of the log files. When the logfile grows beyond this value,
|
||||
icecast will either rename it to logfile.old, or add a timestamp to the archived file (if logarchive is enabled).
|
||||
</div>
|
||||
<h4>logarchive</h4>
|
||||
<div class="indentedbox">
|
||||
If this value is set, then icecast will append a timestamp to the end of the logfile name when logsize has been reached.
|
||||
If disabled, then the default behavior is to rename the logfile to logfile.old (overwriting any previously saved
|
||||
logfiles). We disable this by default to prevent the filling up of filesystems for people who don't care (or know) that
|
||||
their logs are growing.
|
||||
</div>
|
||||
<h4>loglevel</h4>
|
||||
<div class="indentedbox">
|
||||
Indicates what messages are logged by icecast. Log messages are categorized into one of 4 types, Debug, Info, Warn, and Error.<br /><br />The following mapping can be used to set the appropraite value :
|
||||
|
@ -948,10 +948,18 @@ static void _parse_logging(xmlDocPtr doc, xmlNodePtr node,
|
||||
} else if (strcmp(node->name, "playlistlog") == 0) {
|
||||
if (configuration->playlist_log && configuration->playlist_log != CONFIG_DEFAULT_PLAYLIST_LOG) xmlFree(configuration->playlist_log);
|
||||
configuration->playlist_log = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
} else if (strcmp(node->name, "logsize") == 0) {
|
||||
char *tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
configuration->logsize = atoi(tmp);
|
||||
if (tmp) xmlFree(tmp);
|
||||
} else if (strcmp(node->name, "loglevel") == 0) {
|
||||
char *tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
configuration->loglevel = atoi(tmp);
|
||||
if (tmp) xmlFree(tmp);
|
||||
} else if (strcmp(node->name, "logarchive") == 0) {
|
||||
char *tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
configuration->logarchive = atoi(tmp);
|
||||
if (tmp) xmlFree(tmp);
|
||||
}
|
||||
} while ((node = node->next));
|
||||
}
|
||||
|
@ -155,6 +155,8 @@ typedef struct ice_config_tag
|
||||
char *error_log;
|
||||
char *playlist_log;
|
||||
int loglevel;
|
||||
int logsize;
|
||||
int logarchive;
|
||||
|
||||
int chroot;
|
||||
int chuid;
|
||||
|
@ -217,6 +217,8 @@ void restart_logging (ice_config_t *config)
|
||||
snprintf (fn_error, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->error_log);
|
||||
log_set_filename (errorlog, fn_error);
|
||||
log_set_level (errorlog, config->loglevel);
|
||||
log_set_trigger (errorlog, config->logsize);
|
||||
log_set_archive_timestamp(errorlog, config->logarchive);
|
||||
log_reopen (errorlog);
|
||||
}
|
||||
|
||||
@ -225,6 +227,8 @@ void restart_logging (ice_config_t *config)
|
||||
char fn_error[FILENAME_MAX];
|
||||
snprintf (fn_error, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->access_log);
|
||||
log_set_filename (accesslog, fn_error);
|
||||
log_set_trigger (errorlog, config->logsize);
|
||||
log_set_archive_timestamp(errorlog, config->logarchive);
|
||||
log_reopen (accesslog);
|
||||
}
|
||||
|
||||
@ -233,6 +237,8 @@ void restart_logging (ice_config_t *config)
|
||||
char fn_error[FILENAME_MAX];
|
||||
snprintf (fn_error, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->playlist_log);
|
||||
log_set_filename (playlistlog, fn_error);
|
||||
log_set_trigger (errorlog, config->logsize);
|
||||
log_set_archive_timestamp(errorlog, config->logarchive);
|
||||
log_reopen (playlistlog);
|
||||
}
|
||||
}
|
||||
|
@ -194,6 +194,9 @@ static int _start_logging(void)
|
||||
snprintf(fn_error, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->error_log);
|
||||
errorlog = log_open(fn_error);
|
||||
log_to_stderr = 0;
|
||||
if (config->logsize)
|
||||
log_set_trigger (errorlog, config->logsize);
|
||||
log_set_archive_timestamp(errorlog, config->logarchive);
|
||||
} else {
|
||||
errorlog = log_open_file(stderr);
|
||||
log_to_stderr = 1;
|
||||
@ -213,6 +216,9 @@ static int _start_logging(void)
|
||||
snprintf(fn_access, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->access_log);
|
||||
accesslog = log_open(fn_access);
|
||||
log_to_stderr = 0;
|
||||
if (config->logsize)
|
||||
log_set_trigger (accesslog, config->logsize);
|
||||
log_set_archive_timestamp(accesslog, config->logarchive);
|
||||
} else {
|
||||
accesslog = log_open_file(stderr);
|
||||
log_to_stderr = 1;
|
||||
@ -239,6 +245,9 @@ static int _start_logging(void)
|
||||
_fatal_error(buf);
|
||||
}
|
||||
log_to_stderr = 0;
|
||||
if (config->logsize)
|
||||
log_set_trigger (playlistlog, config->logsize);
|
||||
log_set_archive_timestamp(playlistlog, config->logarchive);
|
||||
} else {
|
||||
playlistlog = -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user