How to Setup WordPress Error logs in WP-Config

Debug & save your error logs info in a file using just three simple steps

In the world of codes, there is nothing that is perfect. You may struggle with issues or bugs, especially if you’re working with various themes and plugins. The Problems that occur required troubleshooting. WordPress logs will help you find out what errors are causing your site issue and enable you to track them to their source.

WordPress websites can fix problems that arise. The feature tracks errors and records them in one easy-access file. This makes it easy to get your troubleshooting started. Debugging mode within WordPress is turned off by default but quite easy to enable. Before you get started, be sure to back up your site and create a staging site to work in.

Get started with these steps: 

1) Access your website's files using FTP

First, you’ll need direct access to your WordPress site’s files to activate your WordPress logs. Using a File Transfer Protocol (FTP) will allow you to log directly into your site.

2) Edit your wp-config.php file

After you access your website’s root directory, Then you’ll find the wp-config.php file in the root directory of your WordPress website. Open the file in an editor and add the following code.

Note: If you find this code is already in your wp-config.php file and is set to false, You need to change it to true.

define( 'WP_DEBUG', true )

After that, you will also need to add the following code in your wp-config.php file just below the WP_DEBUG line.

define( 'WP_DEBUG_LOG', true ); 

3) Find debug.log file

After saving the file, you need to visit your WordPress website and access the pages appearing in errors or warnings. After that, log in to your website using an FTP client or file manager in your cPanel.
Once you’re in, go to /wp-content/ folder, and inside it, you will find a file called debug.log.
You can download that file, view, or edit this file. It will include all WordPress errors, warnings, and notices that were logged.

It is not recommended to use WP_DEBUG or the other debug tools on live websites. They are expected for local testing and staging installs.

Darshana Tharanga

I’m Darshana. A Computer Network undergraduate based in Colombo, Lk, who enjoys building things that live on the internet. I develop exceptional websites, web apps, and web content.

Related Articles

Leave a Reply

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

Back to top button