httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Kraemer <>
Subject Re: pre-patch: struct sockaddr_in error messages
Date Sat, 25 Oct 1997 00:02:25 GMT
On Fri, Oct 24, 1997 at 04:08:56PM -0700, Dean Gaudet wrote:
> I disagree with making this another flag to aplog_error for the exact same
> reasons that I don't like aplog_error in the first place -- it assumes it
> knows far more about what you're doing than you do.  What happens when I
> want to print two addresses in an error message?  Say I want to print the
> proxy local and remote addresses?  Or say I want to print
> r->connection->local_addr?  What, add another 3 flags? 

What I was thinking of was not inventing another flag for aplog_error().
In fact, I think the APLOG_NOERRNO solution is suboptimal.
Instead, i would have preferred if aplog_error()'s format scanner had been
extended so that when the caller had said
    aplog_error(APLOG_MARK, APLOG_ERR, r->server,
	"Cannot read file %s: Error %E", filename, errno);
and got
[Fri Oct 24 01:07:12 1997] [error] Cannot read file /bla: Error (2)No such file or directory

in place of today's
    aplog_error(APLOG_MARK, APLOG_ERR, r->server,
	"Cannot read file %s", filename);
[Fri Oct 24 01:07:12 1997] [error] (2)No such file or directory: Cannot read file /bla

One would simply pass the format string containing fields like %E for the
"(errno)strerror(errno)" string, %S for the IPaddr:port string, %H for
the HTTP return code, and other useful strings to aplog_errno(). The
advantage, as Dean said already, is that these fields can be given
multiply in one call, and are expanded on the fly, without overwriting
each other.

Similar to Dean's proposals, it could then have looked like this:
    aplog_error(APLOG_MARK, APLOG_ERR, r->server,
	"Returning %H: Client %A gave invalid password to server %A:%P",
	    server->sin_addr.s_addr, port);

| S I E M E N S |  <>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

View raw message