Viewing Your Error Log to Find and Fix Problems

Checking your error_log every once in a while will help to identify problems that you might not even know exist! Since, in production environments, it’s best to hide the warnings and non-severe errors in PHP applications from displaying to your visitors, we hide the error reporting from the screen and push it to the logs instead. This means you could be getting errors that you don’t know about, but it also means your visitors won’t be seeing them either – definitely a plus.

If you happen to be coding your own web apps or plugins, then monitoring the error log is even more important since it will help you follow good coding practices. The less errors and warnings in your code, the more likely it is to be compatible with up and coming releases of PHP (and other languages as well).

Alternatively, if you’re using applications built by others, the error log will inform you of any incompatibilities, outdated apps or plugins, and clues to resolving a variety of other issues.

Here’s how to do it:

  1. Login to Plesk via the client centre: clients.websavers.ca
  2. Choose the “Logs” button (under the domain you want to view logs for).  Here you will see all logs — error and access logs from both apache and nginx.
  3. In the upper right hand corner you can click to choose which logs you wish to view. Simply uncheck all that do not have “error” in the name to see only error log entries.

Look for warnings and errors and even notices to see if there’s anything you can do to quash them. Entries like those containing a missing favicon.ico can be ignored. A few good techniques to working with your error log:

  • If you have a reproducible problem, follow your steps to reproduce, then watch the error_log for a description of the problem occurring at exactly the time you reproduced the issue
  • Use Google to look up the errors. Copy and paste an error in to Google and you will likely see many websites describing what they are and how to fix them. Just make sure you `sanitize` them first by removing anything unique to your website or server, such as names, web address, and IP addresses. Also remove timestamps as they will be useless as keywords

Jordan is a computer, security, and network systems expert and a lover of all things web and tech. Jordan consults with project management for software companies. Jordan is a founder and managing partner at Websavers Inc.