WP Debug Log File Illustration

I learned about the debug.log file from Sucuri Security’s support team. We use Sucuri on many client sites that are on our WordPress Maintenance Plan. The debug.log file is not enabled by default. To enable it, you have to modify the wp-config.php file by adding these lines before the “That’s all, stop editing! Happy blogging.” comment.

Adding this code to the wp-config.php file will allow WordPress to create a debug.log file in the wp-content directory. New errors get appended to this file. I don’t want the debug.log file to be accessed in a browser, so I added this line to my .htaccess file:

# Protect debug.log file
<Files debug.log>
Order Allow,Deny
Deny from all
</Files>

Now the debug.log file can only be accessed via SSH or an editor like Coda, Dreamweaver, Sublime, etc. A debug.log file looks like this:

WordPress Debug Log File

All of the errors in this screenshot are related to the Divi WordPress theme which is the theme that this site used when this post was created. The first error says that $shortcode_atts is deprecated. I also see mention of the Accordion.php file. The only place that I used the accordion module was on our FAQ page. Each time I visited the FAQ page, that same error was added to the debug.log file. Divi has been updated quite a few times since I first created the FAQ page, so I recreated all of the questions and answers with the accordion module again. After recreating the questions and answers, I looked at the coding in the revisions section, and I saw that the coding for the accordion module had indeed changed from when I last updated our FAQ page.

I copied and pasted the other type of log error into Google and was lead to Sean Barton’s post about turning off Divi minification and static CSS file generation. I followed the instructions in his blog post and cleared the debug.log file. If the errors were not corrected by my steps, I would see these errors again. At the moment, this site’s debug.log file is still empty.

If I wasn’t able to find a solution to any errors in a website’s debug.log file, I contact the plugin or theme author. Usually, the plugin or theme editor has a solution for the problem. If they can’t fix the error, and it’s an intolerable error, then I’ll switch themes or plugins.

My Preferred WordPress Plugins

If you’ve found this post helpful or if you have anything useful to add, please let me know in the comments. I wouldn’t mind if you shared it as well.