How to Set up WordPress Error Logs in WP-Config File

set up WordPress error logs

Are you having trouble with errors and warnings? Want to set up WordPress error logs in wp-config file? Well, this is very easy to set up WordPress error logs and very helpful to debug an error or warning. 

In this post, I am going to show you to set up WordPress error logs in wp-config.php file step by step. 

Let’s start. 

Wp-config is one of the crucial files of WordPress that contains settings for your website. These settings tell your website how to connect to the WordPress database. It is common that WordPress site faces error and warnings. 

These errors and warnings can be solved very easily if the reason is detected easily. This can be done quickly from the WordPress error logs. By default, error logs are not enabled. To enable it, you have to set up WordPress error logs in wp-config.php file.

Set up WordPress Error Logs in WP-Config File

To Set up WordPress error login in WP-config file first, you have to connect your website with an FTP client like FileZilla or any file manager app in cPanel of your Website.

Step 1: Open File Manager

I am using cPanel. All I did was log in to cPanel and open File Manager. You should also find your File manager after login into your website with FTP client.

Step 2: Edit ‘wp-config’ File

When you open the root directory, you will find “wp-config.php”. Right-click on it and click on the Edit option. 

Step 3: Insert Code

Press Ctrl + F and search for ‘Happy publishing’. Now before this line, insert the below code. 

define( 'WP_DEBUG', true );

If you find that the code is already there and is set to false, then just set it to true. 

This will turn on WordPress debug mode. If you want your errors to be logged, then you need to add the following code in wp-config.php file, just below the WP_DEBUG line. 

define( 'WP_DEBUG_LOG', true );

Now save changes.

Review Error Logs

To review error logs at first visit your website and access the pages that are causing errors or warnings. Now connect your website with FTP client or file manager of cPanel. 

Navigate to /home/wp-content/ folder. Here you will find a file called debug.log.

Now right-click on the file and view it. You can also download it and open it on your computer. In this way, you can review errors from the error log. 

Final Words

I hope this helped you to set up WordPress error logs in wp-config file of your website. If you liked the post, then please share it with your friends, and don’t forget to leave your thoughts in the comment box below. 

Was this helpful?

Thanks for your feedback!

Leave a Reply

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

Introducing New Table Block Plugin - Tableberg

X
Need help?