See this answer: Wildcards in Virtual Hosts with dynamic logs?
The short answer is no, you can't have some sort of dynamic
ErrorLog definition that will create separate logs for each virtual host through a single
ErrorLog setting, but you can do some tricks for
CustomLog to add the virtual host to the log, and then pipe the output to a script to parse the data out and write to distinct log files.
I think all of that is relatively complex, though. I would write a script that generates per-vhost configuration files into a specific directory, each with their own
CustomLog directives, and then use
Include to include that directory's files into the overall configuration. Make the script run and complete just before every server start, restart, or HUP.
The other option is to code an Apache module that introduces a configuration directive that allows you to do what you want.