How to Set Up WordPress Error Logs In wp-config.php File For Your Website ?

How to Set Up WordPress Error Logs In wp-config.php File For Your Website ?

Are you finding it difficult to check for WordPress errors in errror_log.php file in root directory like public_html. If you are also using some custom script other than WordPress in your website it becomes extremely to find out which of the errors are from WordPress and which are from other script. It will be convenient if we could find a way to display WordPress errors at a different location. This can be done by setting up WordPress error logs in wp-config file ? The wp-config file controls your WordPress site settings, it can also be used as a debugging tool to find and fix the errors. Lets see how to set up WordPress error logs in the wp-config file.

How it is useful to Set up WordPress Error logs in wp-config file –

wp-config file is very important file as it controls the high level setting of a WordPress website. Following setting are usually done in wp-config file :

  1. Setting up database parameters like Database name, DB Username & Password. You can also setup the table prefix of the database, charset and collate type.
  2. Setting up various keys like Auth keys, Nonce key, Auth Salt etc.
  3. Enable of disable several parameter like the Debug mode, disallow theme and plugin edit etc.

The last point is used for setting up the WordPress Error Log in wp-config file. By setting up this you will easily be able to check the error log of various themes and plugins used in your website. Then you can easily find and fix the error.

Finally Setting up the WordPress Error Logs in wp-config file

If you check your wp-config.php file you will find a following section of code just above the “Happy Blogging” line –

/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the Codex.
*
* @link https://codex.wordpress.org/Debugging_in_WordPress
*/
define(‘WP_DEBUG’, false);

By default he Debug mode is disabled. You can turn it on by changing false to true.

How you can edit wp-config will depend upon the access you have :

1. If you have cPanel access –

a. Open the File manager in cPanel

b. Go to WordPress installation directory.

c. Look for wp-config.php file and open it in edit mode.

d. Search for define(‘WP_DEBUG’, false);

e. Change the value false to true.

f. Save the file and its done.

2. If you have FTP access only – 

a. Open you FTP account using a FTP client like FileZilla.

b. Reach to the WordPress installation directory and look for wp-config.php file.

c. Download this file wp-config to edit it on local system.

d. Open the wp-config file in editor and search for define(‘WP_DEBUG’, false);

e. Change the value false to true.

f. Save the file and upload it back.

Check the result of this setup of WordPress Error Logs in wp-config file –

To check the result open the file manager either in cPanel or FTP account as per the access you have. Go to wp-content folder and look for file debug.log . This is the file where you will find the WordPress error logs.

 

If you like above article, please subscribe. We will keep you updated with our new Articles.

Leave your Feedback / Questions in Comments.

Leave a Reply

eighteen + four =

Close Menu