You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by pq...@apache.org on 2005/03/23 23:04:15 UTC

svn commit: r158839 - apr/apr/trunk/memory/unix/apr_pools.c

Author: pquerna
Date: Wed Mar 23 14:04:14 2005
New Revision: 158839

URL: http://svn.apache.org/viewcvs?view=rev&rev=158839
Log:
Check the 'APR_POOL_DEBUG_LOG' for an alternative to stderr for debugging pools.  I found this very helpful when trying to debug things that detach from the tty, like httpd when not running with -DONE_PROCESS.  If 'APR_POOL_DEBUG_LOG' is not set, the original behavoir of spewing out on stderr is maintained.

Modified:
    apr/apr/trunk/memory/unix/apr_pools.c

Modified: apr/apr/trunk/memory/unix/apr_pools.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/memory/unix/apr_pools.c?view=diff&r1=158838&r2=158839
==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c (original)
+++ apr/apr/trunk/memory/unix/apr_pools.c Wed Mar 23 14:04:14 2005
@@ -29,6 +29,7 @@
 #include "apr_time.h"
 #define APR_WANT_MEMFUNC
 #include "apr_want.h"
+#include "apr_env.h"
 
 #if APR_HAVE_STDLIB_H
 #include <stdlib.h>     /* for malloc, free and abort */
@@ -1198,6 +1199,9 @@
 APR_DECLARE(apr_status_t) apr_pool_initialize(void)
 {
     apr_status_t rv;
+#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
+    char* logpath;
+#endif
 
     if (apr_pools_initialized++)
         return APR_SUCCESS;
@@ -1224,7 +1228,16 @@
     }
 
 #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
-    apr_file_open_stderr(&file_stderr, global_pool);
+    rv = apr_env_get(&logpath, "APR_POOL_DEBUG_LOG", global_pool);
+
+    if (rv == APR_SUCCESS) {
+        apr_file_open(&file_stderr, logpath, APR_APPEND|APR_WRITE|APR_CREATE,
+                      APR_OS_DEFAULT, global_pool);
+    }
+    else {
+        apr_file_open_stderr(&file_stderr, global_pool);
+    }
+
     if (file_stderr) {
         apr_file_printf(file_stderr,
             "POOL DEBUG: [PID"