1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-06-23 06:25:24 +00:00

Add log cycling on HUP signals. Currently reopens log files in append mode

so allows for continuing the log, or cycling just one log.   log filename
changes work as well.

svn path=/trunk/icecast/; revision=5129
This commit is contained in:
Karl Heyes 2003-07-11 23:54:50 +00:00
parent d637781802
commit 421df597fa
3 changed files with 24 additions and 2 deletions

View File

@ -39,6 +39,7 @@ void event_config_read(void *arg)
else {
config_clear(config);
config_set_config(&new_config);
restart_logging ();
config_release_config();
}

View File

@ -1,5 +1,6 @@
#include <stdio.h>
#include <time.h>
#include <string.h>
#include "thread.h"
#include "httpp.h"
@ -9,6 +10,8 @@
#include "refbuf.h"
#include "client.h"
#include "os.h"
#include "config.h"
#include "logging.h"
#ifdef _WIN32
@ -69,7 +72,24 @@ void logging_access(client_t *client)
void restart_logging ()
{
ice_config_t *config = config_get_config_unlocked();
if (strcmp (config->error_log, "-"))
{
char fn_error[FILENAME_MAX];
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_reopen (errorlog);
}
if (strcmp (config->access_log, "-"))
{
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_reopen (accesslog);
}
}

View File

@ -75,6 +75,7 @@ extern int accesslog;
#define LOGGING_FORMAT_CLF "%d/%b/%Y:%H:%M:%S %z"
void logging_access(client_t *client);
void restart_logging (void);
#endif /* __LOGGING_H__ */