Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable error log in Ubuntu Apache

How can I enable error log on my Ubuntu Apache Server so that if any error occurs be it any PHP Syntax and other errors, server error should get stored in error log file

Also how can I view apache error log file?

like image 315
D555 Avatar asked May 15 '14 10:05

D555


People also ask

Where is Apache error log in Ubuntu?

Debian / Ubuntu Linux Apache error log file location – /var/log/apache2/error. log.

How do I open Apache error log?

On a Linux server, you can access Apache error logs from var/log/apache2/error. log. You can then log out the errors from the error log file by writing the following command: sudo tail -f /var/log/apache2/error.

How do I enable Apache logs?

Open your /etc/apache2/apache2. conf file and place the line above below the other LogFormat lines. It will produce access log entries with the following details: %t : date and time of the request.


1 Answers

By default, /var/log/apache2/error.log.

This can be configured in /etc/php5/apache2/php.ini

You can also define a specific error log file for each VirtualHost in Apache. If you have any VirtualHost defined in /etc/apache2/sites-available/ and enabled in /etc/apache2/sites-enabled (enable with sudo a2ensite [your-virtualhost-definition-file]), you can change the error log by adding the following line inside your VirtualHost config:

ErrorLog ${APACHE_LOG_DIR}/[your-vhost]-error.log

That might be useful if you have a lot of vhosts and want to split where they report the errors.

Also, you can watch your error log live by issuing the following command (adapt to your own log file if different from the default):

sudo tail -f /var/log/apache2/error.log

For more information check out the following links

  • where-are-the-apache-and-php-log-files
  • HTTPD - Apache2 Web Server
  • how-to-configure-logging-and-log-rotation-in-apache-on-an-ubuntu-vps
like image 132
Dushyant Joshi Avatar answered Sep 23 '22 12:09

Dushyant Joshi