How to Enable WordPress debug and Log error on debug.log

As we Know By Using the Debug We can Solve Any problem in PHP.  The WordPress Also Support the Debugging Concept.To debug we need to enable the Debug First in PHP. The Same Thing is Apply in WordPress because WordPress is the Cms Based on PHP.To Enable the Debug we need to Follow the Following steps.
Step 1 Go to wp-config.php
Find
define('WP_DEBUG', false);
in wp-Config.php as shown in the below image

Change
define('WP_DEBUG', false)
to
define('WP_DEBUG', true)
and under this past this code
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG', true);
Step 3: Go wp-content
And Check debug.log file under wp-content is available or not if not available create file called debug.log
as shown in the below

Whatever the Error we get all the error is going to log in debug.log
Suppose if we need to add custom error in the debug.log we need to use predefined  function called
error_log("You log message");

By using the above function it will log in debug.log as shown below

0 comments:

Post a Comment

Don't Forget to comment