httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Armstrong <a...@hexten.net>
Subject mod_log_config log writer interface, buffered logging
Date Thu, 02 Dec 2004 08:29:28 GMT
In Apache 2 mod_log_config exposes an interface (via optional functions 
ap_log_set_writer_init and ap_log_set_writer) that allows the log writer 
to be replaced. I've used that interface to implement mod_log_rotate 
which does time based log rotation in a similar way to rotatelogs.

This is worthwhile in the case where you have lots of virtual servers 
all with their own rotated logs: if you use rotatelogs you get an extra 
process and additional file descriptors per virtual server.

Unfortunately mod_log_config also uses this interface internally to 
implement the BufferedLogs directive. Both BufferedLogs and my 
RotateLogs globally switch the log writing routines. In effect this 
makes the two directives mutually exclusive but this isn't transparent 
to the user - if they use BufferedLogs after RotateLogs log rotation 
will cease globally and if they use RotateLogs after BufferedLogs all 
logging will be unbuffered.

This is a general problem for any module that intercepts log output 
using the ap_log_set_writer interface. I notice that BufferedLogs 
doesn't yet seem to be documented and that it's flagged as 
'experimental'. Does that mean I've jumped on an interface I shouldn't 
be using? :)

The options seem to be:

o ignore the problem in the code, fix it in documentation
o modify mod_log_config so that buffering is moved upstream of the log
   writer and doesn't use the ap_log_set_writer interface
o merge the log rotation logic into mod_log_config.

Any thoughts?

-- 
Andy Armstrong


Mime
View raw message