]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1203634, r1204614, r1205564:
authorStefan Fritsch <sf@apache.org>
Wed, 23 Nov 2011 20:40:01 +0000 (20:40 +0000)
committerStefan Fritsch <sf@apache.org>
Wed, 23 Nov 2011 20:40:01 +0000 (20:40 +0000)
Pass ap_errorlog_info to error_log hook

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1205573 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
docs/manual/developer/new_api_2_4.xml
include/ap_mmn.h
include/http_core.h
include/http_log.h
server/log.c

diff --git a/CHANGES b/CHANGES
index d07b5e18ca80235b28556ba71156f99f1012d388..be54ecb844b33a6677d2218c56a48dae69117341 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.0
 
+  *) core: Pass ap_errorlog_info struct to error log hook. [Stefan Fritsch]
+
   *) mod_cache_disk: Make sure we check return codes on all writes and
      attempts to close, and clean up after ourselves in these cases.
      PR43589. [Graham Leggett]
diff --git a/STATUS b/STATUS
index 04c1e71789853af2abbe2c8acfb95a5164bb34a3..22c4884abcb3d11d01f118babdde3996b74a8799 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -106,9 +106,6 @@ RELEASE SHOWSTOPPERS:
     (Either fixing it or removing it constitutes an API change, which is
     why it matters)
 
-  * Change the arguments to the error log hook, to allow access to the 
-    conn_rec. Or decide that we don't want it.
-
   NEW ISSUES THAT WOULD BE NICE TO HAVE DONE IN 2.4 BUT ARE NOT BLOCKERS
 
   * Configure code for luajit is broken (links to wrong library).
index 821da87b290a75cdd0ec0886d3558eac81c8be65..1a19c1955e7218d8f05ecf15c10024adbe38a528 100644 (file)
       <li>New function ap_get_server_name_for_url to support ipv6 literals.</li>
       <li>New function ap_register_errorlog_handler to register errorlog
           format string handlers.</li>
+      <li>Arguments of error_log hook have changed. Declaration has moved to
+          <code>http_core.h</code>.</li>
       <li>New function ap_state_query to determine if the server is in the
           initial configuration preflight phase or not. This is both easier to
           use and more correct than the old method of creating a pool userdata
index 1dd264736832960c43e4a758540d7840fcb4e091..d5a702fea655719187d1371fc7c8d2b5baf23d07 100644 (file)
  * 20111025.2 (2.3.15-dev) Add ap_lua_ssl_val to mod_lua
  * 20111025.3 (2.4.0-dev)  Add reclvl to ap_expr_eval_ctx_t
  * 20111122.0 (2.4.0-dev)  Remove parts of conn_state_t that are private to the MPM
+ * 20111123.0 (2.4.0-dev)  Pass ap_errorlog_info struct to error_log hook,
+ *                         add pool to ap_errorlog_info.
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
 
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20111122
+#define MODULE_MAGIC_NUMBER_MAJOR 20111123
 #endif
 #define MODULE_MAGIC_NUMBER_MINOR 0                   /* 0...n */
 
index a6be6fb883fce836dc0f322bbb0907582b3fbb0e..12a29e4279bb78c800b58cdfac65849fdd7a6419 100644 (file)
@@ -776,14 +776,17 @@ typedef struct ap_errorlog_info {
     /** r->main if r is a subrequest, otherwise equal to r */
     const request_rec *rmain;
 
-    /** name of source file where the log message was produced. */
+    /** pool passed to ap_log_perror, NULL otherwise */
+    apr_pool_t *pool;
+
+    /** name of source file where the log message was produced, NULL if N/A. */
     const char *file;
     /** line number in the source file, 0 if N/A */
     int line;
 
     /** module index of module that produced the log message, APLOG_NO_MODULE if N/A. */
     int module_index;
-    /** log level of error message, -1 if N/A */
+    /** log level of error message (flags like APLOG_STARTUP have been removed), -1 if N/A */
     int level;
 
     /** apr error status related to the log message, 0 if no error */
@@ -844,6 +847,19 @@ typedef struct {
     unsigned int min_loglevel;
 } ap_errorlog_format_item;
 
+/**
+ * hook method to log error messages
+ * @ingroup hooks
+ * @param info pointer to ap_errorlog_info struct which contains all
+ *        the details
+ * @param errstr the (unformatted) message to log
+ * @warning Allocating from the usual pools (pool, info->c->pool, info->p->pool)
+ *          must be avoided because it can cause memory leaks.
+ *          Use a subpool if necessary.
+ */
+AP_DECLARE_HOOK(void, error_log, (const ap_errorlog_info *info,
+                                  const char *errstr))
+
 AP_CORE_DECLARE(void) ap_register_log_hooks(apr_pool_t *p);
 AP_CORE_DECLARE(void) ap_register_config_hooks(apr_pool_t *p);
 
index 6a1717bb37932f9f1f12bd565af638516324f648..68a6c8f20dd8bc4a72b47abdea100ebd408743ab 100644 (file)
@@ -624,25 +624,6 @@ AP_DECLARE(apr_file_t *) ap_piped_log_read_fd(piped_log *pl);
  */
 AP_DECLARE(apr_file_t *) ap_piped_log_write_fd(piped_log *pl);
 
-/**
- * hook method to log error messages
- * @ingroup hooks
- * @param file The file in which this function is called
- * @param line The line number on which this function is called
- * @param module_index The module_index of the module generating this message
- * @param level The level of this error message
- * @param status The status code from the previous command
- * @param s The server which we are logging for
- * @param r The request which we are logging for
- * @param pool Memory pool to allocate from
- * @param errstr message to log
- */
-AP_DECLARE_HOOK(void, error_log, (const char *file, int line,
-                       int module_index, int level,
-                       apr_status_t status, const server_rec *s,
-                       const request_rec *r, apr_pool_t *pool,
-                       const char *errstr))
-
 /**
  * hook method to generate unique id for connection or request
  * @ingroup hooks
index 90ccfa2efb8f6eb775046406cf05291f9d513e69..605d75bbeabb0b2cba9651fa7b2e564bdc6bcf9c 100644 (file)
@@ -1177,6 +1177,7 @@ static void log_error_core(const char *file, int line, int module_index,
 
     info.s             = s;
     info.c             = c;
+    info.pool          = pool;
     info.file          = NULL;
     info.line          = 0;
     info.status        = 0;
@@ -1268,8 +1269,7 @@ static void log_error_core(const char *file, int line, int module_index,
              * prefix and suffix.
              */
             errstr[errstr_end] = '\0';
-            ap_run_error_log(file, line, module_index, level, status, s, r, pool,
-                             errstr + errstr_start);
+            ap_run_error_log(&info, errstr + errstr_start);
         }
 
         *errstr = '\0';
@@ -1763,11 +1763,8 @@ AP_DECLARE(const char *) ap_parse_log_level(const char *str, int *val)
 }
 
 AP_IMPLEMENT_HOOK_VOID(error_log,
-                       (const char *file, int line, int module_index, int level,
-                        apr_status_t status, const server_rec *s,
-                        const request_rec *r, apr_pool_t *pool,
-                        const char *errstr), (file, line, module_index, level,
-                        status, s, r, pool, errstr))
+                       (const ap_errorlog_info *info, const char *errstr),
+                       (info, errstr))
 
 AP_IMPLEMENT_HOOK_RUN_FIRST(int, generate_log_id,
                             (const conn_rec *c, const request_rec *r,