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 19:03:45 GMT
ok.
I was think of something which would dump some of the notes table out into the line.
for example mod_include generates the following;
[Mon Jun 04 12:03:24 2001] [error] [client 127.0.0.1] unable to include "/components/precached/002-${CNET_ID}-001-0001-ftr.html"
in parsed file proxy:http://cn-sfo1-x-app58.cnet.com:7701/mace/123-333-12309128.html

I could use the hook to print out all notes starting with 'CNET' 

the other use we might have for it is to suppress certain error messages from printing out.

some of our developers decided to use the 'errorHandler' logic to implement a 'default page'
for some app on the
server.. so now we get 20+ error lines (which aren't errors) per second. we could use this
kind of hook to supress these
messages from appearing (easier than getting the developers to change their code ;( )


> -----Original Message-----
> From: rbb@covalent.net [mailto:rbb@covalent.net]
> Sent: Monday, June 04, 2001 8:17 AM
> To: 'new-httpd@apache.org'
> Subject: RE: New hook.
> 
> 
> On Mon, 4 Jun 2001, Ian Holsman wrote:
> 
> > 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?
> 
> I specifically didn't do that, because the error log is paramount.  I
> believe the most important thing is that the error is written to the
> error log.  If a module seg-faults during this phase, I don't 
> want that to
> stop the error from being logged to the official error log.
> 
> I can see the argument for allowing modules to add to the error, but I
> can't see what they would add, or how to ensure that they 
> don't stop the
> error from being logged.
> 
> Ryan
> 
> >
> >
> > > -----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
> > > --------------------------------------------------------------
> > > -----------------
> > >
> > >
> >
> >
> 
> 
> ______________________________________________________________
> _________________
> Ryan Bloom                        	rbb@apache.org
> 406 29th St.
> San Francisco, CA 94131
> --------------------------------------------------------------
> -----------------
> 

Mime
View raw message