On a development server, I'd like to turn logging on only when needed for specific debugging operations. One way I can think of is Apache checks for the existence of certain dotfile somewhere and decides no a SetEnvIf dontlog variable value based on that. How would I configure this or is there a more optimal way?
I'd like to avoid a full-server reload to toggle this switch.
You have the possibility to pipe logs to a program when using CustomLog. An example usecase would be log rotation, as desribed here: rotatelogs
Depending on your skills, you could write a custom logger which would only log under whatever critera you desire.
The benefit here would be, that you wouldn't have to restart or reload Apache at all.
Here a more general description of piped logging: piped logs
You can use the third argument of the CustomLog directive to specify a condition which determines whether or not to log that request.
The third argument can be an environment variable or as of Apache 2.4 it can be an expression (like checking HTTP_COOKIE).