WordPress Log

wordpress log

What is wordpress log file? How we enable it?

Thank you for reading my blog. After reading this article you will able to learn what is WordPress log and its usage in development of WordPress site. As a wordpress developer wordpress log file help me to find out issues in my theme and query variable. I always ask my team members to use wordpress log file in development sites and ask them to remove once they are moved into live site.

A log file in a file that write information related to the program execution into it. By analyzing the log file we can find out main issues in wordress site. This log file is very help full in day to day WordPress theme development and plugin development.

WordPress developer community recomending all developr to use WP_DEBUG mode while they developing a plugin or wordpress theme.

Let see how you can enable WP_DEBUG

WP_DEBUG is a PHP constant (a permanent global variable) that can be used to trigger the “debug” mode throughout WordPress. It is assumed to be false by default and is usually set to true in the wp-config.php file on development copies of WordPress.

define( 'WP_DEBUG', true );
define( 'WP_DEBUG', false );
wordpress log

wordpress log help developers to debug wordpress themes and plugins.

 

 

 

 

 

 

 

 

 

You can read more about the log tool details here

So from now onward if you are developing a WordPress theme or plugin please make sure that you enabled the debug mode. The advantage of this is, we can easyly enable and disable this from wp-config file. Only one line of simple code needed to add to enable wordpress log system. But make sure that you removed the code one you migrate you site in to live server. This debug wordpress log is only meant for development sites.

Tip:

Note that this allows you to write to /wp-content/debug.log using PHP’s built in error_log() function, which can be useful for instance when debugging AJAX events.

define( 'WP_DEBUG_LOG', true );

Reply