You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Randy Terbush <ra...@zyzzyva.com> on 1997/07/27 21:49:20 UTC

Re: [PATCH] loglevels final?

dgaudet@arctic.org said:
> While I'm much happier with this approach (I too want it to be simple,
> and
> syslog-style levels are just fine with me) you didn't address one of
> my
> earlier complaints. 
> 
> On Sun, 27 Jul 1997, Randy Terbush wrote:
> 
> > -void log_pid(pool *p, char *pid_fname) {
> > +API_EXPORT(void) aplog_error (int level, const request_rec *r,
> const char *routine,
> > +			      const char *file, const char *fmt, ...)
> > +{
> 
> I think that the prototype should be: 
> 
> API_EXPORT(void) aplog_error (int level, const request_rec *r,
>     const char *fmt, ...);

I agree, I like losing the baggage.  However, unless I am being stupid,
I need this info to easily provide the existing output format for 
non-native modules. We have control over distributed stuff but 
would have to decide to dictate some other format for modules that 
continue to use the old routines. 


> one of the reasons is this code: 
> 
> > +    if (timestamp) { /* timestamp means we are logging to file */
> > +	fprintf(r->server->error_log, "%s", errstr);
> > +	vfprintf(r->server->error_log, fmt, args);
> > +	fflush(r->server->error_log);
> > +    }
> > +    else {
> > +	if (errstr)
> > +	    syslog(level, "%s", errstr);
> > +
> > +	vsyslog(level, fmt, args);
> > +    }
> 
> Is not atomic for the syslog. 
> 
> I also feel that "routine" and "file" are very vague, and don't apply
> to
> all situations.
> 
> BTW you should probably also implement:
> 
> API_EXPORT(void) aplog_verror (int level, const request_rec *r,
>     va_list args); 
> 
> Dean




Re: [PATCH] loglevels final?

Posted by Dean Gaudet <dg...@arctic.org>.
Yeah to deal with varags you have to do something like this:

/* filename:linenumber */
#define AP_HERE	__FILE__ ":" #__LINE__

aplog_error (AP_HERE, blah, blah, blah)

Dean

On Sun, 27 Jul 1997, Brian Behlendorf wrote:

> At 04:07 PM 7/27/97 -0500, Randy wrote:
> >We could just pass these into a variable argument list, but one of 
> >the motivations of this change is to get some control over the 
> >format of the error message. Perhaps someone here knows a way to 
> >get __FILE__, __LINE__ from the calling function, but I don't.
> 
> Make aplog_error a macro?  i.e.
> 
> #define aplog_error(a,b,c) aplog_err(__FILE__, __LINE__, a,b,c)
> 
> but then we couldn't deal with varargs...
> 
> 	Brian
> 
> 
> --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
> "Why not?" - TL           brian@organic.com - hyperreal.org - apache.org
> 


Re: [PATCH] loglevels final?

Posted by Ben Laurie <be...@algroup.co.uk>.
Brian Behlendorf wrote:
> 
> At 04:07 PM 7/27/97 -0500, Randy wrote:
> >We could just pass these into a variable argument list, but one of
> >the motivations of this change is to get some control over the
> >format of the error message. Perhaps someone here knows a way to
> >get __FILE__, __LINE__ from the calling function, but I don't.
> 
> Make aplog_error a macro?  i.e.
> 
> #define aplog_error(a,b,c) aplog_err(__FILE__, __LINE__, a,b,c)
> 
> but then we couldn't deal with varargs...

And then you have Explain with logging levels... why not just enhance
Explain a little?

Cheers,

Ben.

-- 
Ben Laurie                Phone: +44 (181) 994 6435  Email:
ben@algroup.co.uk
Freelance Consultant and  Fax:   +44 (181) 994 6472
Technical Director        URL: http://www.algroup.co.uk/Apache-SSL
A.L. Digital Ltd,         Apache Group member (http://www.apache.org)
London, England.          Apache-SSL author

Re: [PATCH] loglevels final?

Posted by Brian Behlendorf <br...@organic.com>.
At 04:07 PM 7/27/97 -0500, Randy wrote:
>We could just pass these into a variable argument list, but one of 
>the motivations of this change is to get some control over the 
>format of the error message. Perhaps someone here knows a way to 
>get __FILE__, __LINE__ from the calling function, but I don't.

Make aplog_error a macro?  i.e.

#define aplog_error(a,b,c) aplog_err(__FILE__, __LINE__, a,b,c)

but then we couldn't deal with varargs...

	Brian


--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
"Why not?" - TL           brian@organic.com - hyperreal.org - apache.org

Re: [PATCH] loglevels final?

Posted by Dean Gaudet <dg...@arctic.org>.

On Sun, 27 Jul 1997, Randy Terbush wrote:

> I agree, I like losing the baggage.  However, unless I am being stupid,
> I need this info to easily provide the existing output format for 
> non-native modules. We have control over distributed stuff but 
> would have to decide to dictate some other format for modules that 
> continue to use the old routines. 

Old modules will use the old functions ... and you can just rewrite the
wrappers to deal with the new aplog_error prototype, can't you? 

Dean