How to easily disable log in apache

Posted on Thursday February 17, 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:

  • /etc/apache2/sites-available/default-ssl
  • /etc/apache2/sites-available/default

and change the ErrorLog and comment out the CustomLog:

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