From: Ryan Bloom Date: Wed, 6 Jun 2001 22:24:54 +0000 (+0000) Subject: Add a new request phase, for allowing management modules to forward X-Git-Tag: 2.0.19~133 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06ca840aa4e1037d1d282603196461b2b2107120;p=thirdparty%2Fapache%2Fhttpd.git Add a new request phase, for allowing management modules to forward error logs to their management agents. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89281 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 1f060b87ab7..bf148b6af13 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,11 @@ Changes with Apache 2.0.19-dev + *) Add a new request hook, error_log. This phase allows modules + to act on the error log string _after_ it has been written + to the error log. The goal for this hook is to allow monitoring + modules to send the error string to the monitoring agent. + [Ryan Bloom] + *) Modify mod_echo to make it use filters for input and output. [Ryan Morgan ] diff --git a/include/http_log.h b/include/http_log.h index 71d50a3e502..1b39029911c 100644 --- a/include/http_log.h +++ b/include/http_log.h @@ -275,6 +275,11 @@ AP_DECLARE(void) ap_close_piped_log(piped_log *pl); */ #define ap_piped_log_write_fd(pl) ((pl)->fds[1]) +AP_DECLARE_HOOK(void, error_log, (const char *file, int line, int level, + apr_status_t status, const server_rec *s, + const request_rec *r, apr_pool_t *pool, + const char *errstr)) + #ifdef __cplusplus } #endif diff --git a/server/log.c b/server/log.c index a73abb02347..d634b8ef807 100644 --- a/server/log.c +++ b/server/log.c @@ -96,6 +96,10 @@ typedef struct { int t_val; } TRANS; +APR_HOOK_STRUCT( + APR_HOOK_LINK(error_log) +) + #ifdef HAVE_SYSLOG static const TRANS facilities[] = { @@ -455,6 +459,7 @@ static void log_error_core(const char *file, int line, int level, syslog(level_and_mask, "%s", errstr); } #endif + ap_run_error_log(file, line, level, status, s, r, pool, errstr); } AP_DECLARE(void) ap_log_error(const char *file, int line, int level, @@ -750,3 +755,10 @@ AP_DECLARE(void) ap_close_piped_log(piped_log *pl) apr_pool_cleanup_run(pl->p, pl, piped_log_cleanup); } +AP_IMPLEMENT_HOOK_VOID(error_log, + (const char *file, int line, int level, + apr_status_t status, const server_rec *s, + const request_rec *r, apr_pool_t *pool, + const char *errstr), (file, line, level, + status, s, r, pool, errstr)) +