Apache: Log messages from CGI to own file

I would like to have all the output from the (perl) CGIs in its own log file.

What i tried:

Setting ScriptLog /var/log/httpd/cgi.log in httpd.conf, but this had no effect. Probably something else is missing.

Any ideas?


ScriptLog only logs errors. You can use comparison values at the end of the CustomLog statement to output specific events into another log. I think something like this will do what you want (tested):

    SetEnvIf Request_URI "^/cgi-bin/" cgilog
    CustomLog ${APACHE_LOG_DIR}/access.log combined env=!cgilog
    CustomLog ${APACHE_LOG_DIR}/cgi.log combined env=cgilog