httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r734973 - in /httpd/httpd/trunk: docs/man/rotatelogs.8 docs/manual/programs/rotatelogs.xml support/rotatelogs.c
Date Fri, 16 Jan 2009 11:08:19 GMT
Author: rjung
Date: Fri Jan 16 03:08:15 2009
New Revision: 734973

URL: http://svn.apache.org/viewvc?rev=734973&view=rev
Log:
Mostly revert r733493: signal based rotation
for rotatelogs.

Prefer adding reliable piped logs to the error
loggers in httpd, so that one could simply
kill rotatelogs and httpd automatically starts new
instances of all loggers.

Modified:
    httpd/httpd/trunk/docs/man/rotatelogs.8
    httpd/httpd/trunk/docs/manual/programs/rotatelogs.xml
    httpd/httpd/trunk/support/rotatelogs.c

Modified: httpd/httpd/trunk/docs/man/rotatelogs.8
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/man/rotatelogs.8?rev=734973&r1=734972&r2=734973&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/man/rotatelogs.8 (original)
+++ httpd/httpd/trunk/docs/man/rotatelogs.8 Fri Jan 16 03:08:15 2009
@@ -33,7 +33,7 @@
 .SH "SUMMARY"
  
 .PP
-rotatelogs is a simple program for use in conjunction with Apache's piped logfile feature\&.
It supports rotation based on a time interval or maximum size of the log\&. Rotation happens
automatically during log activity, but can also be triggered externally with the signals SIGHUP
(checks the configured rotation rules) and SIGINT (force rotate)\&.
+rotatelogs is a simple program for use in conjunction with Apache's piped logfile feature\&.
It supports rotation based on a time interval or maximum size of the log\&.
  
 
 .SH "OPTIONS"

Modified: httpd/httpd/trunk/docs/manual/programs/rotatelogs.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/programs/rotatelogs.xml?rev=734973&r1=734972&r2=734973&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/programs/rotatelogs.xml (original)
+++ httpd/httpd/trunk/docs/manual/programs/rotatelogs.xml Fri Jan 16 03:08:15 2009
@@ -28,10 +28,7 @@
 <summary>
      <p><code>rotatelogs</code> is a simple program for use in
      conjunction with Apache's piped logfile feature.  It supports
-     rotation based on a time interval or maximum size of the log.
-     Rotation happens automatically during log activity, but can also
-     be triggered externally with the signals SIGHUP (checks the
-     configured rotation rules) and SIGINT (force rotate).</p>
+     rotation based on a time interval or maximum size of the log.</p>
 </summary>
 
 <section id="synopsis"><title>Synopsis</title>

Modified: httpd/httpd/trunk/support/rotatelogs.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/support/rotatelogs.c?rev=734973&r1=734972&r2=734973&view=diff
==============================================================================
--- httpd/httpd/trunk/support/rotatelogs.c (original)
+++ httpd/httpd/trunk/support/rotatelogs.c Fri Jan 16 03:08:15 2009
@@ -48,7 +48,6 @@
 #include "apr_general.h"
 #include "apr_time.h"
 #include "apr_getopt.h"
-#include "apr_signal.h"
 
 #if APR_HAVE_STDLIB_H
 #include <stdlib.h>
@@ -63,18 +62,6 @@
 #define MAX_PATH        1024
 #endif
 
-#ifdef SIGHUP
-#ifdef SIGINT
-#define HAVE_SIGNALS    1
-#define SIG_CHECK       SIGHUP
-#define SIG_FORCE       SIGINT
-#endif
-#endif
-
-#define CHECK_LOG       0
-#define CHECK_SIG_CHECK 1
-#define CHECK_SIG_FORCE 2
-
 #define ROTATE_NONE     0
 #define ROTATE_NEW      1
 #define ROTATE_TIME     2
@@ -114,7 +101,6 @@
     char filename[MAX_PATH];
     char errbuf[ERRMSGSZ];
     int rotateReason;
-    int checkReason;
     int tLogEnd;
     int nMessCount;
 };
@@ -219,10 +205,6 @@
  *
  * When size and time constraints are both given,
  * it suffices that one of them is fulfilled.
- *
- * If the method finds a reason for rotation,
- * and it hasn't been called while log data is available,
- * it will close the open log file as a side effect.
  */
 static void checkRotate(rotate_config_t *config, rotate_status_t *status)
 {
@@ -230,9 +212,6 @@
     if (status->nLogFD == NULL) {
         status->rotateReason = ROTATE_NEW;
     }
-    else if (status->checkReason == CHECK_SIG_FORCE) {
-        status->rotateReason = ROTATE_FORCE;
-    }
     else if (config->sRotation) {
         apr_finfo_t finfo;
         apr_off_t current_size = -1;
@@ -264,16 +243,6 @@
         fprintf(stderr, "File rotation needed, reason: %s\n", ROTATE_REASONS[status->rotateReason]);
     }
 
-    /*
-     * Let's close the file before immediately
-     * if we got here via a signal.
-     */
-    if ((status->rotateReason != ROTATE_NONE) &&
-        (status->checkReason != CHECK_LOG)) {
-        closeFile(config, status->pfile, status->nLogFD);
-        status->nLogFD = NULL;
-        status->pfile = NULL;
-    }
     return;
 }
 
@@ -372,39 +341,7 @@
         status->pfile_prev = NULL;
     }
     status->nMessCount = 0;
-    /*
-     * Reset marker for signal triggered rotation
-     */
-    status->checkReason = CHECK_LOG;
-}
-
-#ifdef HAVE_SIGNALS
-/*
- * called on SIG_CHECK and SIG_FORCE
- */
-static void external_rotate(int signal)
-{
-    /*
-     * Set marker for signal triggered rotation check
-     */
-    if (signal == SIG_FORCE) {
-        status.checkReason = CHECK_SIG_FORCE;
-    }
-    else {
-        status.checkReason = CHECK_SIG_CHECK;
-    }
-    /*
-     * Close old file conditionally
-     */
-    checkRotate(&config, &status);
-    /*
-     * Open new file if force flag was set
-     */
-    if (config.force_open && (status.rotateReason != ROTATE_NONE)) {
-        doRotate(&config, &status);
-    }
 }
-#endif
 
 /*
  * Get a size or time param from a string.
@@ -489,7 +426,6 @@
     status.nLogFDprev = NULL;
     status.tLogEnd = 0;
     status.rotateReason = ROTATE_NONE;
-    status.checkReason = CHECK_LOG;
     status.nMessCount = 0;
 
     apr_pool_create(&status.pool, NULL);
@@ -553,22 +489,9 @@
         doRotate(&config, &status);
     }
 
-#ifdef HAVE_SIGNALS
-    apr_signal(SIG_CHECK, external_rotate);
-    apr_signal(SIG_FORCE, external_rotate);
-#endif
-
     for (;;) {
         nRead = sizeof(buf);
-#ifdef HAVE_SIGNALS
-        apr_signal_unblock(SIG_CHECK);
-        apr_signal_unblock(SIG_FORCE);
-#endif
         rv = apr_file_read(f_stdin, buf, &nRead);
-#ifdef HAVE_SIGNALS
-        apr_signal_block(SIG_FORCE);
-        apr_signal_block(SIG_CHECK);
-#endif
         if (rv != APR_SUCCESS) {
             exit(3);
         }



Mime
View raw message