I like to maintain separate Apache2 logfiles for each of my named virtual hosts, like this:
<VirtualHost *:80> ServerName myhost.example.com ErrorLog /var/log/apache2/myhost-error.log </VirtualHost *:80>
The nominated file correctly gathers error-messages generated by Apache2 itself, such as 404s:
[Thu Jul 18 12:07:45 2013] [error] [client 10.0.0.141] File does not exist: /home/mike/myhost/htdocs/favicon.ico
But when myhost runs mod_perl scripts which emit their own logging messages (using print to STDERR, for example), those messages still appear in the global Apache2 error-log, /var/log/apache2/error.log.
This is using Apache 2.2.16 on Debian GNU/Linux 6.0, but I also see the same thing on Ubuntu 12.04.2 LTS and on MacOS 10.5 -- I guess it's standard Apache2 behaviour.
I want my mod_perl scripts' logging to appear in the site-specific error-log just like the 404s and other Apache-level errors. How can I make this happen?