]> granicus.if.org Git - apache/commitdiff
Set up stderr logging explictly early in initialization so that a pool is
authorJeff Trawick <trawick@apache.org>
Thu, 4 Jan 2001 18:22:50 +0000 (18:22 +0000)
committerJeff Trawick <trawick@apache.org>
Thu, 4 Jan 2001 18:22:50 +0000 (18:22 +0000)
available for creating the APR representation of stderr.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87583 13f79535-47bb-0310-9956-ffa450edef68

include/http_log.h
libhttpd.def
server/log.c
server/main.c

index c35c6d37dabf30bbba45b18116394fd6dd27e4ab..fa8aeb003973a3d1413a5fe535189389a4e1d0bd 100644 (file)
@@ -113,6 +113,12 @@ extern "C" {
 
 #define APLOG_MARK     __FILE__,__LINE__
 
+/**
+ * Set up for logging to stderr.
+ * @param p The pool to allocate out of
+ */
+void ap_open_stderr_log(apr_pool_t *p);
+
 /**
  * Open the error log and replace stderr with it.
  * @param s_main The main server
index 160e61b84ac22066e6bb127a931db0b8d5ce4843..4b20e0d3f3eca21460f50dbf0a5494a033d0f314 100644 (file)
@@ -418,3 +418,4 @@ EXPORTS
        ap_xml_insert_uri
 
        ap_os_create_privileged_process
+       ap_open_stderr_log
index bd167872ccb45a02c13c1deaf033b74522781e18..30435891c0a0b202c38bdd3bd44f45c8b8d0102b 100644 (file)
@@ -174,6 +174,13 @@ static const TRANS priorities[] = {
     {NULL,     -1},
 };
 
+static apr_file_t *stderr_log;
+
+void ap_open_stderr_log(apr_pool_t *p)
+{
+    apr_open_stderr(&stderr_log, p);
+}
+
 static int log_child(apr_pool_t *p, const char *progname,
                      apr_file_t **fpin)
 {
@@ -346,7 +353,7 @@ static void log_error_core(const char *file, int line, int level,
        if (((level & APLOG_LEVELMASK) != APLOG_NOTICE) &&
            ((level & APLOG_LEVELMASK) > DEFAULT_LOGLEVEL))
            return;
-       apr_open_stderr(&logf, pool);
+        logf = stderr_log;
     }
     else if (s->error_log) {
        /*
index 388face9ab244a92eaa50d7e4ca3cdd1526f1e32..25eca86492f87867bf374d6580496631e0639689 100644 (file)
@@ -214,6 +214,9 @@ static process_rec *create_process(int argc, const char * const *argv)
 
     stat = apr_create_pool(&cntx, NULL);
     if (stat != APR_SUCCESS) {
+        /* XXX From the time that we took away the NULL pool->malloc mapping
+         *     we have been unable to log here without segfaulting.
+         */
         ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL,
                      "apr_create_pool() failed to create "
                      "initial context");
@@ -221,6 +224,8 @@ static process_rec *create_process(int argc, const char * const *argv)
         exit(1);
     }
 
+    ap_open_stderr_log(cntx);
+
     process = apr_palloc(cntx, sizeof(process_rec));
     process->pool = cntx;