httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: error_log hook
Date Fri, 19 Feb 2010 15:54:42 GMT
Are you aware of the custom log formats and how you can add headers to the log lines and put
the in an arbitrary file?

------Original Message------
From: David Sklar
Subject: error_log hook
Sent: Feb 19, 2010 7:42 AM

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,

Sent via BlackBerry by AT&T
View raw message