I am attempting to write a module that uses the error_log hook to
augment error log messages with some custom information (some items
from r->headers_in, mostly).

Splatting *additional* information to the already-configured ErrorLog
is not too difficult by attaching a function to the hook, building
whatever string I want in the function, and then apr_file_puts()ing my
string to s->error_log.

Additionally, it looks like by borrowing logic similar to what's in,
e.g. mod_log_forensic, I can add a custom directive (e.g.
MyFancyErrorLog) that specifies a filename and have my
specially-formatted error log messages written to this other file as
well. (I'm explicitly ignoring pipes and syslog for the moment.)

But what I'd *really* like to do is bypass the default error logging
entirely. That is, instead of having log_error_core (from
server/log.c) figure out the log level magic, format the error string
with client, referer, etc. log it to the ErrorLog and *then* call the
hook, I want my function to replace log_error_core. But I don't see an
obvious way to do that. Is there some way I can override
ap_log_error/ap_log_perror/ap_log_rerror and provide alternative
implementations that call something other than log_error_core ?

Thanks for any advice,
David

Reply via email to