[xiph-cvs] cvs commit: icecast/src event.c logging.c logging.h

Karl Heyes karl at xiph.org
Fri Jul 11 16:54:50 PDT 2003



karl        03/07/11 19:54:50

  Modified:    src      event.c logging.c logging.h
  Log:
  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.

Revision  Changes    Path
1.3       +1 -0      icecast/src/event.c

Index: event.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/event.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- event.c	15 Mar 2003 02:10:17 -0000	1.2
+++ event.c	11 Jul 2003 23:54:50 -0000	1.3
@@ -39,6 +39,7 @@
     else {
         config_clear(config);
         config_set_config(&new_config);
+        restart_logging ();
 
         config_release_config();
     }

<p><p>1.5       +23 -3     icecast/src/logging.c

Index: logging.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/logging.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- logging.c	15 Mar 2003 02:10:17 -0000	1.4
+++ logging.c	11 Jul 2003 23:54:50 -0000	1.5
@@ -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 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);
+    }
+}

<p><p>1.7       +1 -0      icecast/src/logging.h

Index: logging.h
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/logging.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- logging.h	2 Feb 2003 14:32:21 -0000	1.6
+++ logging.h	11 Jul 2003 23:54:50 -0000	1.7
@@ -75,6 +75,7 @@
 #define LOGGING_FORMAT_CLF "%d/%b/%Y:%H:%M:%S %z"
 
 void logging_access(client_t *client);
+void restart_logging (void);
 
 #endif  /* __LOGGING_H__ */
 

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list