change apache log level

How to Change Apache Log Level

Apache provides different levels of logging to help you capture the precise information about incoming requests to your website. In this article, we will look at how to change Apache log level. We will also look at the different log levels available in Apache web server as well as the default logging level used for websites.

How to Change Apache Log Level

Apache uses the LogLevel directive to set the logging level for websites. Depending on the value specified for LogLevel directive, Apache logs different kinds of information. Here are the steps to change Apache log level.

1. Open Apache configuration file

Apache configuration file is located at one of the following locations, depending on your installation.

  • /etc/apache2/httpd.conf
  • /etc/apache2/apache2.conf
  • /etc/httpd/httpd.conf
  • /etc/httpd/conf/httpd.conf

Open it in a text editor.

$ sudo vi /etc/apache2/httpd.conf

Also read : How to Change Apache Log Location

2. Change Apache log level

Look for the LogLevel directive in Apache configuration file. It sets the level of logging. It can assume the following values, listed in the order of severity, starting from low to high

  • trace1 – trace8 – Trace messages
  • debug – Debugging messages
  • info – Informational messages
  • notice – Notices
  • warn – Warnings
  • error – Errors occured while processing a request
  • crit – Critical issues that need prompt action
  • alert – Alerts, require immediate attention
  • emerg – Emergency situation. Server is in an unusable state.

Each log level above, includes the logging for all higher levels. For example, if you set LogLevel to crit, then it also includes crit, alert and emerg.

The default LogLevel is warn. It is advisable to set LogLevel to at least crit.

Also read : What File Permissions For Apache File/Folders

3. Restart Apache Server

After you have set Apache LogLevel, restart server to apply changes.

$ sudo service apache2 restart

Also read : How to Disable TLS 1.0/1.1 in Apache Server

Leave a Reply

Your email address will not be published. Required fields are marked *