title: Apache server -- multiple directories, different error logs
body: <p>I have two directories in /var/www (say, /var/www/app1 and /var/www/app2) whose error logs I want sent to different files.  Both are under the same domain, so I <em>think</em> that I can't put them under different virtual hosts.  So, for example, I would access them as:</p>
  
  <p><a href="http://localhost/app1" rel="nofollow noreferrer">http://localhost/app1</a></p>
  
  <p><a href="http://localhost/app2" rel="nofollow noreferrer">http://localhost/app2</a></p>
  
  <p>I came across this page:</p>
  
  <p><a href="https://stackoverflow.com/questions/1460757/generate-access-logs-for-different-subdirectories-in-apache">Generate access logs for different subdirectories in Apache</a></p>
  
  <p>whose solution works perfectly for the access logs.  However, the "env" argument doesn't seem to work with the ErrorLog directive.</p>
  
  <p>Before this "discovery", I was working on this, which seems wrong:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
    ServerAdmin ray@localhost
  
    DocumentRoot /var/www/app1
  
    &lt;Directory /&gt;
      Options Indexes FollowSymLinks MultiViews
      AllowOverride None
      Order deny,allow
      allow from all
    &lt;/Directory&gt;
  
    ErrorLog ${APACHE_LOG_DIR}/app1/error.log
  
    LogLevel warn
  
    CustomLog ${APACHE_LOG_DIR}/app1/access.log combined
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I'm somewhat lost about what I should be doing.  That is, if there is some way to get ErrorLog to work or if I should keep trying with configuring a virtual host for each directory.  Any help would be appreciated!  Thank you!</p>