httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Sklar <david.sk...@gmail.com>
Subject Re: error_log hook
Date Fri, 19 Feb 2010 17:10:20 GMT
True, but that's just access log, not error log. I need the additional
information (such as request headers) attached to the error log
messages, not the access log messages.

One other possibility I was considering was just to have my module, on
a per-request basis, append the error log messages passed into the
hook function to a note in the notes table (similar to how
ap_log_rerror works with the "error-note" note except that repeated
error log strings would append) and then use a CustomLog access log to
log the info I care about and the accumulated note. Doing it that way
wouldn't be the end of the world, but:
- it means that nothing gets written out until the log_transaction
phase, which could be problematic for error info during
broken/long-runing requests
- appending to a mostly-unbounded (I could set some crazy upper limit)
buffer is not the fastest thing in the world


David


On Fri, Feb 19, 2010 at 10:54 AM,  <mcqueenorama@gmail.com> wrote:
> 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
> To: modules-dev@httpd.apache.org
> ReplyTo: modules-dev@httpd.apache.org
> 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,
> David
>
>
> Sent via BlackBerry by AT&T

Mime
View raw message