André Warnier wrote:
Vegard Vesterheim wrote:

 CustomLog .... env=!is_googlebot

See also:     http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html
    http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#customlog

 - Vegard V -


That looks just too easy to be true..
But I believe you of course, and Thanks.

It's just that I have seen this same kind of question pop up regularly on forums, and I don't remember ever seeing the simple suggestion above.
...
As a matter of fact, the original poster on the other forum just got the same answer from someone else.

I do remain interested in a possible mod_perl solution though, because I already have some add-on Apache/perl handler modules where such a functionality would come in handy sometimes.

You could use a transhandler to set your own loghandler based on the request url.

$r->set_handlers( PerlResponseHandler => [ 'My::PerlLogHandler' ] )
    if $should_skip_apache_loghandler;

And then write your own PerlLogHandler which returns Apache2::Const::OK (which should tell Apache to skip the log handler phase).

package My::PerlLogHandler;

use strict;
use warnings;

use Apache2::Const -compile => qw( OK );

sub handler;
    my $r = shift;
    return Apache2::Const::OK;
}


I have a suspicion that I might have to look at the ServerRec or something like that, and make the change in the configuration on-the-fly...

Reply via email to