httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aidan Cully <>
Subject Re: adding vhost-specific data to shared error logs
Date Fri, 18 Dec 1998 23:18:08 GMT
On Wed, Dec 16, 1998 at 04:57:59PM, Dean Gaudet said:
> On Tue, 15 Dec 1998, Aidan Cully wrote:
> > I hate to follow up to myself, but no one else has, and I really don't
> > want to continue wasting my time on this feature if no one cares enough
> > about it to let me know.
> > 
> > So is this useful to people?  Should I be posting to another forum, or
> > should I file a PR on it?  Should I just forget about this feature?
> I think it's useful but I haven't had a chance to look at your work... 

Groovy, that's all I really needed to hear.  I'll fix the bugs I know
about, do some testing, and resubmit it.

To save time, here's an overview of the patch:
Change server_rec->error_log from a FILE* to a log_type_rec*, where
log_type_rec is defined as follows:
struct log_type_rec {
    int type;
    void *data;
where "data" is type dependant, and type can be one of LOG_TYPE_SYSLOG,
LOG_TYPE_FILE and LOG_TYPE_SHARE.  For SYSLOG, data is ignored, for
FILE, data is a FILE*, and for SHARE, data is a pointer to a structure:
struct shared_log_rec {
    char *string;
    log_type_rec *share;
(of course, everything that deals directly with error_log has been
modified to expect log_type_rec's, rather than FILE*'s.)

To support shared loggers, I added another field to server_rec, named
(surprisingly) shared_loggers.  shared_loggers is an array of named
log_type_rec's..  The ap_init_virtual_host function has been modified
to use the same 'shared_loggers' pointer among every host.  The
AddLogger configuration checks context, then adds another shared_logger
to this array.  The way it does this is to call a modified
"open_error_log" function (called ap_open_one_log) that returns a
log_type_rec*, and associates that with a string.  The old
open_error_log() has been modified to take the return value of
ap_open_one_log() and stick it into server_rec->error_log.

When ap_open_one_log() encounters a shared logger declaration, it
searches through server_rec->shared_loggers for the appropriate one,
and associates a shared_log_rec* with the associated log_type_rec*.

The log_error_core() function has been made recursive..  When an
error_log is SHAREd, it prints the header into a buffer and calls
itself again.

Hope this is all clear..
Aidan Cully       "I assume you're all in bands.."
Panix Staff          --Robyn Hitchcock

View raw message