How to Set Up: "WordPress Error Logs" in WP-Config
Diagnosing WordPress issues, especially for non technical individuals can be daunting. This guide shows you a quick way to use the error log to give you feedback on what’s wrong with your site.
Retrieving error log entries allows you to either fix the problem yourself or have someone knowledgeable in WordPress internals handle it.
Steps to capture the error log
1. Open the File Manager in your web host’s management panel.
alt=
Log into your hosting provider account and bring up your CPanel or equivalent interface. Open the File Manager.
Log into your hosting provider account and bring up your CPanel or equivalent interface. Open the File Manager.

2. Go to the document directory of your website installation.
This will most likely be in the public_html directory or a subdirectory of public_html depending on if you are hosting more than one domain with this account.

3. Make a backup of wp-config.php.
Make a backup of wp-config.php to ensure you can restore the system after you’re done debugging.
Note: When you make a backup of the file using the CPanel File Manager, a dialog will ask you where you want to copy the file to. Since you’re just copying a backup to the same directory, type in a new filename here as shown below.

4. Open wp-config.php and insert or edit lines that control logging.
The following constant definitions need to be either added or edited in your wp-config.php file:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
Most WordPress installations already have an entry for WP_DEBUG set to false so you’ll need to change this value to true. It’s not that common to have WP_DEBUG_LOG already set in the wp-config so most likely you’ll have to add that line.
After you’re done editing ensure that WP_DEBUG and WP_DEBUG_LOG are set to true and that each constant is only defined once in wp-config.php
5. Repeat the failed WordPress operation.
You may have observed the problems on a particular screen on the admin page, page on your site or are experiencing something as catastrophic as your site not coming up at all. Go into WordPress and simply repeat the operation or refresh the page that isn’t working properly.
6. Go to the WordPress content folder and open debug.log.
Go to the WordPress content folder. This is usually called wp-content, unless you renamed it with a security plugin.
Open the log file debug.log, go to the bottom and look for line entries with timestamps that correspond to your recent site interactions. You may see zero, one, or many lines with the appropriate timestamp.


7. Fix identified problems yourself or send log information to someone who can.
Depending on your level of confidence and understanding you can either act on this information or copy and paste the latest log entries into an email that you can send to someone more technical.
8. Restore the original wp-config.php.
Finally, remove the wp-config.php that you edited and rename the copy to wp-config.php
_____________________________________________________________________________
2nd Method
Why and When You Need to Set up WordPress Error Logs in WP-Config
The wp-config.php file is a WordPress configuration file that contains important WordPress settings. These settings tell your website how to connect to your WordPress database, which database table prefix to use, and generates authentication keys to make your WordPress site more secure.
To learn more about wp-config file, please see our article on how to edit wp-config file in WordPress.
Apart from default WordPress settings, wp-config file can also be used to define several other parameters. It can also enable WordPress debugging mode and save WordPress error logs.
This helps you find WordPress errors by identifying the plugins or scripts that are causing them. You can then go ahead and find a fix for those WordPress errors.
That being said, let’s take a look at how to enable and setup WordPress error logs in wp-config file.
Setting up WordPress Error Logs in WP-Config File
First, you will need to edit your wp-config.php file. You can access it by connecting to your website using an FTP client or File Manager app in cPanel.

You will find wp-config.php file in the root directory of your website. Open the file in any text editor and look for the line that says ‘That’s all, stop editing! Happy blogging.’
Just before this line you need to add the following code:
1
| define( 'WP_DEBUG', true ); |
It is possible that this code is already in your wp-config.php file and is set to false. In that case, you just need to change it to true.
This line alone will turn on WordPress debug mode. However the downside of using this debugging alone is that you will see WordPress errors and warnings inside your admin area as well as front page of your website.
If you want errors to be logged, then you will also need to add the following code in your wp-config.php file just below the WP_DEBUG line.
1
| define( 'WP_DEBUG_LOG', true ); |
Don’t forget to save your changes and upload your wp-config.php file back to your website.
Reviewing Your WordPress Error Logs
First you need to visit your WordPress site and access the pages that were resulting in errors or warnings. After that, you will need to connect to your website using a FTP client or file manager app in your WordPress hostingcPanel.
Once connected, go to /wp-content/ folder and inside it your will find a file called debug.log.

You can download, view, or edit this file. It will contain all WordPress errors, warnings, and notices that were logged.

That’s all we hope this article helped you learn how to set up WordPress error logs in WP-Config file. You may also want to see our ultimate list of most wanted WordPress tips, tricks, and hacks for beginners.
Tag:
wp error , wp http error 500 , wp error log , wp error establishing a database connection , wp-admin error 500 , crown wp 3000 error code 857 , crown wp 3000 error codes , is_wp_error not working , wp booster error , wp cli error establishing a database connection , wp database error , wp error 404 , wp error 500 , wp error fix , wp error reporting , wp login error , wp network error domain error-994 , wp-login error 500 , wp_error could not be converted to string , wp http error couldn't connect to host , wp http error curl error 77 .
Comments
Post a Comment