WordPress Debug log: Enable in wp-config , SET to True & SET Log path file

If you are facing any errors or facing any technical issues on your WordPress website then you need to enable debug mode in WordPress to know what’s happening on your website and why errors are throwing or showing up on your WordPress website by declaring wp_debug, wp_debug_log, wp_debug_display in wp-config.php.

WordPress Debug Log Not Created why

There may be some times WordPress debug log will not be generated and if debug log is not generated then you need to check the following and see why WordPress debug log is not created

1 – Login in to WordPress via FTP and download wp-config.php

2 – open wp-config.php in your favourite editor

3 – Check the below code and parameters are set to true.

4 – define( 'WP_DEBUG', true );

define( 'WP_DEBUG_LOG', true );

define( 'WP_DEBUG_DISPLAY', false );

After that you need to set the path to generate WordPress debug log as below

define( 'WP_DEBUG_LOG', true );

— OR —

define( 'WP_DEBUG_LOG', '/tmp/wp-errors.log' );

How to Enable Debug Mode in WordPress

It is very easy and simple to enable debug mode in WordPress by just editing wp-config.php in your root directory by adding below code.

Now the Debug log will be generated on the root directory if you use define( 'WP_DEBUG', true );

If you use define( 'WP_DEBUG_LOG', '/tmp/wp-errors.log'); the debug error log will be generated in declared under tmp directory and file wp-errors.log file will be generated by WordPress.

Note: Only error log will be generated if WordPress detects any errors or any issues or php error triggers only or debug log will be empty (sometimes it will generate by empty).

Related Coverage:

1. What are .htaccess Rewriting Rules in WordPress

2. What are Permalinks in WordPress: How to Enable, Customize Permalink Tags

3. Learn Everything About wp-config.php File WordPress

4. What is htaccess file in WordPress and its Uses

5. How to Secure WordPress Website From Hackers

WordPress Debug Log Location

WordPress debug log location will be created by default in root directory/wp-content/debug_errors log as defined filename.

There are 2 PHP Constants of wp_debug in WordPress and they are:

define( 'WP_DEBUG', true );

define( 'WP_DEBUG', false );

By setting the parameter of wp_debug to TRUE, WordPress debug mode will be enabled and displays php warnings, errors, warnings and notices along with any technical difficulties in WordPress.

What Happens when you Enable Debug Mode in WordPress

When you enable debug mode log all your WordPress errors will be displayed in front end and there is also a separate defining in WordPress to set display errors to false even though you set debug mode.

WP_DEBUG_DISPLAY is another companion to WP_DEBUG that controls whether debug messages are shown inside the HTML of pages or not. The default is ‘true’ which shows errors and warnings as they are generated. Setting this to false will hide all errors. This should be used in conjunction with WP_DEBUG_LOG so that errors can be reviewed later.

WordPress Clear Debug Log or Empty Debug Log

Some time when you enable debug mode in WordPress log there is a possibility of errors getting generated again and again which leads to extra file storage and sometimes it creates problems to check latest errors to get rid of this you have remove or enable and disable debug log file in WordPress will do the trik.

WordPress Debug Log Plugins

There are plenty of WordPress debug plugins which will help you dig in deeper which comes very handy and all you have to do is just install the plugin from backend and you can find list of debugging plugins in WordPress here like Query Monitor and other plugins and know more regarding debugging in wordpress here.

Ramana Tula is a - Technical Content Writer and he is a Full stack Web and Android Developer also - SEO Manager and also manages Digital Marketing.

- Advertisement -