How to easily disable log in apache

Posted on Friday, February 18th 2011 / by Eric Potvin

Logs are important, specially for production server. For development or QA servers, they might not be as important since you can turn on errors directly on the screen.

Here's how to easily disable log (access and error log) in apache to avoid excessive writes on local server.

Open your /etc/apache2/apache2.conf file and change the following two configurations:

Change the ErrorLog to:

ErrorLog /dev/null

Now, open /etc/apache2/conf.d/other-vhosts-access-log and comment the following line

#CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined

In addition, you might have to change these files:

and change the ErrorLog and comment out the CustomLog:

ErrorLog /dev/null
#CustomLog ${APACHE_LOG_DIR}/access.log combined

2 comments:

Comments will re-open soon.

posted annonymously
Eric Tuesday, March 26th 2013

Here's what I have in my httpd.conf: ServerName localhost -- Then restart the server, this should work. If not, please either send me your apache conf files or post it somewhere (like jsfiddle.net) so I can check them.

posted annonymously
chandra Tuesday, March 26th 2013

hi, great solutions :) when I changed ErrorLog /dev/null #CustomLog ${APACHE_LOG_DIR}/access.log combined in these files : /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default I get an error message when I restart apache : apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName Action "start" failed. The Apache error log may have more information. [fail] can you help me ? thanks