Apache 2.4 separate error log file for CGI scripts

apache-2.4cgilogging

I am using Apache 2.4 on my server and I want to be able to have a separate error log file for CGI scripts, similar to how I have a separate log file for PHP errors.

Currently, I am using the following rules my virtual host config to have an Apache access log, an Apache error log, and a PHP error log:

CustomLog /home/ubuntu/www/.logs/access.log combined
ErrorLog /home/ubuntu/www/.logs/error.log
php_value error_log /home/ubuntu/www/.logs/php.error.log

What would I have to add or change to get Apache to write CGI errors to its own file? Currently Apache is writing CGI errors to the error.log file.

I tried the following, but it did not change Apache's behavior.

ScriptLog /home/ubuntu/www/.logs/cgi.error.log

Best Answer

Try ScriptLog with a different directory, and give it permissions to the apache unpriviledged user.