On Fri, Jan 04, 2002 at 01:13:37PM -0000, Matt Sergeant wrote:
> > > Hello,
> > > I was wondering if there is any way of making the error log 
> > in Apache to
> > > execute a script when an error is occurred, perhaps instead 
> > of writing the
> > > error directly to the log.

There is a way to redirect errors to your own code.  It's not pretty.

You can see some example code that does this at
http://www.modperlcookbook.org/code/ch16/

You can also download an example module that uses this code to
intercept error log entries and post them to an IRC channel.  Nothing
like real-time errors to keep you on your toes :)

You can now read that entire chapter (and two others) online at

  http://www.modperlcookbook.org/chapters.html

Enjoy!

> > > For example, if there is a image missing Apache excutes a 
> > script that
> > > generates a replacement image?

In this case you're talking about a different type of error condition.
As Matt and Geoff mentioned you can use an ErrorDocument script that
runs whenever this condition exists.  This does not handle other output
that flows into your error_log.

> > well, you can do just about anything you want :)
> > 
> > however, althoughit is possible to intercept the actual errors Apache
> > (and mod_perl) generates, it is rather complex, and really not the
> > proper approach here.
> 
> Really? I would have thought it could make an interesting caching technique
> - on a 404 you try and generate the file, and store in that slot in the
> filesystem. A cache cleanup daemon runs to clean out TTL'd files.

Check out Apache::CacheContent - it implements something similar,
available on CPAN or at http://www.modperlcookbook.org/code.html

> Warning: don't try and implement this in a commercial application - it's
> patented by vignette.

Hmmm, I implemented something like this in the early 90s...  Long
before vignette was even around..


-- 
Paul Lindner    [EMAIL PROTECTED]   ||||| | | | |  |  |  |   |   |

    mod_perl Developer's Cookbook   http://www.modperlcookbook.org
         Human Rights Declaration   http://www.unhchr.ch/udhr/index.htm

Reply via email to