An error log is a file that records what went wrong when a page, script or server request failed.

An error log is a running record of problems on your website. Each time something fails, the server writes a line with the date, time, the file involved and a short description of what happened. When your site shows a blank page or a "500 Internal Server Error", the error log is usually where the real explanation is.

For example, a line like PHP Fatal error: Allowed memory size exhausted in /wp-content/plugins/slider/slider.php on line 212 tells you exactly which plugin ran out of memory and where.

Types of error logs

Most hosting accounts have more than one log:

  • Web server error log: problems handling requests, such as missing files, permission errors and bad .htaccess rules.
  • PHP error log: errors from your code, including fatal errors, warnings and notices. Often saved as a file called error_log in the folder where the script ran.
  • Application logs: some software keeps its own. WordPress writes to debug.log when debugging is turned on.
  • Access log: not an error log, but useful alongside one because it shows every request, including which ones returned errors.

How to read an error log

Start at the bottom, where the newest entries are, and look for lines that match the time the problem happened. Each entry usually tells you:

  1. When it happened.
  2. How serious it was: fatal errors stop the page, warnings and notices usually don't.
  3. What went wrong, in a short message.
  4. Where, as a file path and line number.

The file path often points straight to the cause. A path inside a plugin or theme folder means that plugin or theme is the likely culprit.

Common errors you'll find in an error log

  • Memory limit exhausted, often caused by a heavy plugin or a large import.
  • Calls to undefined functions after a PHP version change.
  • File permission errors after uploading files with the wrong settings.
  • Database connection errors when MySQL details are wrong.
  • Timeouts when a script runs too long.

Error log tips and mistakes to avoid

Don't leave detailed error display switched on for visitors. Showing errors on screen can reveal file paths and other details attackers find useful. Log them to a file instead. Also keep an eye on log size. A plugin that writes thousands of warnings a day can create huge files that use up disk space and inodes. Fix the cause rather than just deleting the log.

On AblePage you can open your logs from cPanel, and if you're stuck, support will read them with you.

Error log questions

Where is the error log in cPanel?
It's under the Metrics section, labelled Errors, which shows recent web server errors. PHP errors are usually saved in a file called error_log in your site's folders.
Is it safe to delete an error log file?
Yes. Deleting it won't break your site, and a new one is created when the next error happens. Fix the underlying problem first, or the file will just fill up again.
How do I turn on error logging in WordPress?
Set WP_DEBUG and WP_DEBUG_LOG to true in wp-config.php. Errors are then written to wp-content/debug.log, and you should turn it off again once you're done.
Was this definition helpful?
Share this definition