summaryrefslogtreecommitdiff
path: root/memory/unix
diff options
context:
space:
mode:
authorpquerna <pquerna@13f79535-47bb-0310-9956-ffa450edef68>2005-03-23 22:04:14 +0000
committerpquerna <pquerna@13f79535-47bb-0310-9956-ffa450edef68>2005-03-23 22:04:14 +0000
commit64347dc3002b7c8304c8f1c22bfbed47cc0aab9e (patch)
tree3a279d4df3ffac16b4f40503a2f6a6a49c345f0b /memory/unix
parent4cce33f1456b3f395a1ddbd2b6948c8cc93d8fb1 (diff)
downloadlibapr-64347dc3002b7c8304c8f1c22bfbed47cc0aab9e.tar.gz
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.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@158839 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'memory/unix')
-rw-r--r--memory/unix/apr_pools.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index d7abede33..7486e673c 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -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 @@ static void apr_pool_check_integrity(apr_pool_t *pool)
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 @@ APR_DECLARE(apr_status_t) apr_pool_initialize(void)
}
#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"