I have updated the gist below. This accounts for changes in Apache SetEnvIf.
Previously I set the env vars to 1 or 0 to turn logging on and off but the value works better if it is a string (e.g. log and nolog) otherwise Apache treats the values 1-9 as special characters and it doesn't work.
Log files can get filled up with repeated calls to files such as favicon, robots.txt, images, css js etc
This can be a pain when you need to scan the logs for issues and they are full of unimportant requests.
This is especially so if you use Ultimate Cron in Drupal and run cron every minute - the logs get swamped with the cron calls.
Mostly you want to log the initial request for a page and not all of the resources subsequently requested.
Troubleshooting other issues may mean you would log files such as favicon, images etc - but generally they needlessly fill up your logs.
Do it occasionally to look for missing images etc.
Put the following section in your Apache config / Vhosts settings for the site (just before the closing VirtualHost tag):
This method set an environment variable for each type of file so that you can turn logging on and off for each as you see fit.
E.g. To turn logging back on for images - update the line: