httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <>
Subject [Patch] Reliable error logs for trunk
Date Thu, 15 Jan 2009 23:21:15 GMT
httpd has a feature called reliable piped logs. When a log process like 
rotatelogs dies, httpd automatically restarts it. This can be used to 
close open log files from outside httpd by simply killing rotatelogs.

This procedure does not work for the error logs, because those are 
started with a different mechanism, even if they are configured with the 
same rotatelogs syntax.

This difference goes back to pre 1.3 httpd.

The patch at

should fix this. I tested it with access and error logs, with the main 
server and virtual hosts and with restarts and logger killing.

The problem is the delicate handling of file descriptors in the main 
error log case.

Should I apply this to trunk?

My tests are only on Solaris. I will also test on Linux, but it would be 
nice if someone could test on Windows too.

Some comments on the patch:

1) The piped_log_maintenance() function used as a callback when the 
logger dies needs one additional data, namely whether the died logger 
was the main error log. We could add this to the piped_log structure, 
but because that is public, I'm not sure whether we want to expose it 
like this. So I preferred to wrap piped_log into piped_log_wrapper locally.

2) I did not yet test the case where AP_HAVE_RELIABLE_PIPED_LOGS is not 
defined, which seems to be a very rare case.

3) To make the behaviour between CustomLog and ErrorLog more consistent 
I added ap_server_root_relative() for the logger path before spawning 
the logger. This is not necessary to achieve the reliable restarts.



View raw message