httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sorin Manolache <sor...@gmail.com>
Subject Re: Capturing error text for output
Date Wed, 18 Mar 2009 08:06:03 GMT
On Wed, Mar 18, 2009 at 02:42, Brooks Sizemore <brooks@darg.net> wrote:
> Hello modules-dev,
>
> What I'm trying to do may not be possible, but I thought I'd ask here. What
> I'd like to do is have all of the error messages that get sent to the error
> log available for redirection to the client browser. My initial searching of
> the code tells me that logging calls like ap_log_rerror(), ap_log_error()
> and the like are just wrappers around log_error_core ()(in log.c), which is
> why I'm a bit doubtful that what I'm trying to do is possible. Not sure how
> CGI scripts send messages to the error log, but I'm assuming it's also done
> through standard ap_log_* calls.
>
> I thought I may be able to send my errors to a pipe, but I don't know how I
> could get that information back into request processing before completing
> the request.
>
> Can I somehow override the behavior of log_error_core()?
>
> Thoughts?
>
> Thanks!

First, the log messages that are issued in the log_transaction hook
cannot be injected in the response as the log_transaction is invoked
after the last packet was sent to the client, the socket flushed and
possibly closed. This is by design.

I don't think there's a way to override the behaviour of
log_error_core (except changing the sources of apache :-)).

However, I can imagine a super-complicated method to send _some_ of
the log messages issued by apache before the response is sent. You
pipe the log messages to an external application (see the syntax of
the ErrorLog and CustomLog directives). Then, your external
application behaves like a server and your module makes requests to
the log server in order to retrieve the message logs. You'd have to
use mod_unique_id and to log the unique ID of a request in order to be
able to distinguish among log messages issued for different requests.
I think it is not worth it because you can stumble in all kind of
synchronisation or deadlock issues and anyway you won't have all the
log messages, especially error messages that will not include the
unique request ID.

S

-- 
A: Because it reverses the logical flow of conversation.
Q: Why is top-posting frowned upon?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

Mime
View raw message