httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Holsman <I...@cnet.com>
Subject RE: New hook.
Date Mon, 04 Jun 2001 15:02:33 GMT
would it make sense to have it so the hook is called >before< the error 
is logged so it could add some additional info to the error line perhaps?


> -----Original Message-----
> From: rbb@covalent.net [mailto:rbb@covalent.net]
> Sent: Sunday, June 03, 2001 10:13 AM
> To: new-httpd@apache.org
> Subject: New hook.
> 
> 
> 
> This patch adds a new hook to the server.  The idea is that it is
> important for any real monitoring service to know whenever an 
> error has
> been logged.  This can be done by having a process watch the 
> error log,
> but then it is harder to find out what kind of error it was, 
> or what the
> errno (apr_status_t) value was.
> 
> The new hook is called after the error log has been written, 
> so that the
> server's error log is effected as little as possible.
> 
> If nobody objects, I will commit this later this week.
> 
> Ryan
> 
> Index: include/http_log.h
> ===================================================================
> RCS file: /home/cvs/httpd-2.0/include/http_log.h,v
> retrieving revision 1.28
> diff -u -d -b -w -u -r1.28 http_log.h
> --- include/http_log.h	2001/05/03 23:39:43	1.28
> +++ include/http_log.h	2001/06/03 15:38:43
> @@ -275,6 +275,11 @@
>   */
>  #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
> Index: server/log.c
> ===================================================================
> RCS file: /home/cvs/httpd-2.0/server/log.c,v
> retrieving revision 1.92
> diff -u -d -b -w -u -r1.92 log.c
> --- server/log.c	2001/05/17 12:10:22	1.92
> +++ server/log.c	2001/06/03 15:38:50
> @@ -96,6 +96,10 @@
>  	int	t_val;
>  } TRANS;
> 
> +APR_HOOK_STRUCT(
> +    APR_HOOK_LINK(error_log)
> +)
> +
>  #ifdef HAVE_SYSLOG
> 
>  static const TRANS facilities[] = {
> @@ -455,6 +459,7 @@
>  	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,
> @@ -749,4 +754,11 @@
>  {
>      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))
> 
> 
> 
> ______________________________________________________________
> _________________
> Ryan Bloom                        	rbb@apache.org
> 406 29th St.
> San Francisco, CA 94131
> --------------------------------------------------------------
> -----------------
> 
> 

Mime
View raw message