I finally decided to do away with an Apache::Registry quirk that's 
bugged me for months. The problem, briefly, is that Apache::Registry 
writes to the error log whenever its eval returns non-zero. So if you 
want your registry script to return a custom error, you can write a 
log message and call Apache::exit(SERVER_ERROR), but you'll get two 
lines in error_log (yours, and Apache::Registry's). Same for 302, 
304, etc.

Apache::RedirectLogFix.pm is one solution - but only for redirect. 
One could also do all the logging in a module, but why duplicate 
Apache's existing code?

Thus the patch... Basically, logging is on by default, and can be 
turned off with a package variable. I think that the "right way" 
would be to sense the difference between a code error and a 
deliberate return value... but I suspect that would require 
modifications to Apache::exit(), with which I'm not inclined to muck.

$ diff -w Registry.pm.orig Registry.pm
26a27,28
>  $Apache::Registry::AutoLog ||= 1;
>
155c157
<           $r->log_error($errsv);
---
>            $r->log_error($errsv) if $Apache::RegistryYA::AutoLog;

Anyway, hopefully this will be useful to someone else too. If there's 
a better way, I'm sure someone will tell me RSN :-).

-- Mike

Reply via email to