Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My apache2.conf file contains the lines ErrorLog /var/www/logs/error_log and CustomLog /var/www/logs/access_log common. I only get server shutdown/restart notifications there, however. All other logs get sent to the original locations (/var/log/apache2). I wasted a day debugging in the blind until I worked that out. How do I get all my logs to get sent where I want them?

The (condensed) apache2.conf file looks similar to this (without the modules and directories):


LockFile ${APACHE_LOCK_DIR}/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
AccessFileName .htaccess
DefaultType None
HostnameLookups Off
ErrorLog /var/www/logs/error_log
LogLevel debug
Include mods-enabled/*.load
Include mods-enabled/*.conf
Include httpd.conf
Include ports.conf
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/www/logs/access_log common
Include conf.d/
Include sites-enabled/

ServerName 158.132.10.185
ServerRoot /var/www
DocumentRoot /var/www
AddType application/x-httpd-cgi .cgi

...
share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

What do you mean by all other logs? You have probably defined a number of virtual hosts and these other logs belong to them. So, you should set log file locations on a per virtual host basis in corresponding VirtualHost configuration sections.

share|improve this answer
    
Actually, I haven't even got to virtual hosts yet. It's not a complicated setup. I meant "all other logging", rather than "all other logs". Sorry. Anyway, the logs in question are error.log, access.log and other_vhosts_access.log. –  Warpspace Aug 8 '12 at 11:16
1  
I suppose you are on Debian or Ubuntu, please check /etc/apache2/sites-available/default, your default VirtualHost configuration is right there. –  Alex Aug 8 '12 at 11:20
    
Ah, you're right. There's another ErrorLog and CustomLog there. Is it better to modify that file, or do something in the apache2.conf file to make it use my settings? –  Warpspace Aug 8 '12 at 11:23
    
Well since settings are per virtual host it's better to modify that file I think. –  Alex Aug 8 '12 at 11:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.