How To Set Up Error Log In WordPress
You must have heard about logs, which are also technically called records of information, that store significant amount of details, especially of a computer system and the applications installed.
Similarly, there are error log for the WordPress CMS which can be used to identify problems that occur in a user’s site built on the WordPress platform. In fact, the error log in WordPress is a very handy debugging tool that can help you find and fix different types of errors.
Such error logs are primarily used by system administrators that gives them a better understanding about a particular issue so that the issue can be diagnosed easily and resolved quickly.
The Purpose of Having Error Log In WordPress
The wp-config.php file contains important settings of WordPress. You can use the settings to carry out various tasks such as:
- Generate authentication keys to secure WordPress site
- Connect to WordPress database
- Use prefix in database table
There are more tasks which a user is privileged to perform in WordPress with the help of the wp-config file. Besides storing WordPress settings, the wp-config file is also used for the purpose of defining many parameters, enabling WordPress debugging mode and saving WordPress error logs. Through this, you can easily find errors in WordPress by identifying the plug-ins or scripts that are the reason for causing issues in WordPress.
Once you have successfully identified the root cause of the problem for which the error has occurred in WordPress, you can go ahead and find an effective solution for the relevant error in WordPress.
How To Set Up WordPress Error Log In WP-Config File
You can set up WordPress error log in a file called wp-config.php. This is a WordPress configuration file that is created using PHP, the same programming language upon which the WordPress CMS is built that renders your website. The wp-config.php file is located in your home (or root) directory, where your WordPress is installed.
The error log for WordPress can be manually created within this wp-config file. Thus, in order to do that, it is required that you must first access the wp-config.php file located in your WordPress directory and then open the file using a text editor. A text editor is an application that allow users to input text and save the data for future reference. All operating system platforms, such as Windows (Microsoft), Mac OS X (Apple) etc., contain a built-in text editor application that can be used to accomplish the task of editing or modifying certain files, including system files. In this case, you are editing the WordPress configuration (wp-config) file.
Do remember that wp-config.php is a critical configuration file in WordPress that contains vital settings and should be used with caution.
When you have located the file, you can select the file and choose to open it by right-clicking on the wp-config file and then selecting the “View/Edit” option from the context menu. You will be able to view the contents of the wp-config.php file in a text editor application.
Here, you are required to simply add a piece of code to allow the error log functionality in WordPress. To do this, simply add the following code before the line that says ‘That’s all, stop editing! Happy blogging.’:
define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_LOG’, true );
Note: If the upper code already exists in the wp-config.php file, but is set to ‘false’, you must set it to ‘true’ in order to allow error logging in WordPress.
Once you have made the necessary changes to the wp-config.php file, do not forget to save the settings. If you try to quit the text editor, it will prompt you to save, discard or cancel the changes made to the file. Here, choose to save the changes made and you’re all set and done.
If you need assistance, simply dial our support phone number <enter-phone-number>. Our WordPress experts at Codexoxo are available 24/7 to guide you, in case you have difficulties performing the operation.