WP_DEBUG_LOG: Logging Error Messages for a Live WordPress Site

Who doesn’t know the situation? Something is going wrong with WordPress. With the configuration, a plugin or a theme and you ask the support community asks for error messages.

To receive those messages in WordPress, you can activate WP_DEBUG. Setting it to the value TRUE causes WordPress (or better PHP) to document all errors in the browser.

Doing so on a productive website might look – hm – not good. What to do?

Logging error messages

With the following lines, added to the wp-config.php, you can log all the errors in a file instead of getting it in the browser:

Result

  • You are in Debug-Mode.
  • No errors will be showed in the browser.
  • All error messages will be documented in /wp-content/debug.log.

Attention!

Better safe than sorry. By default WP_DEBUG_LOG is set to FALSE, because WP_DEBUG really writes EVERYTHING (errors and warnings) and WP_DEBUG_LOG pushes all messages into the log file, as you can see in the core code ( load.php, wp_debug_mode()):

Depending on what is happening on the site, the log file can grow up within a very short time to an exporbitant size, up to gigabytes of data!

That’s why you should use WP_DEBUG_LOG only in places and don’t forget to change the lines in wp-config.php back to default.

Post Sharing

Author Avatar

Hi! My name is Chris and I enthusiastically develop the web from back-end to front-end at Inpsyde. When I'm not discussing accessibility, you can find me at Google+. In my spare time I study computer science, do a lot of sports, read one book after the other and blog at www.chrico.info.

Also Interesting

New Plugin: Slack Connector - Connect WordPress, WooCommerce and Slack

by Michael Firnkes

Initially we merely wanted to optimize our own Slack-processes. With automated notifications from our MarkettPress shop, the blog and our forums. The resul ...

Read more

Inpsyde is the first WordPress.com VIP partner in Germany

by Michael Firnkes

Automattic has given us the title of WordPress.com VIP Service Partner, the first in Germany, Austria and Switzerland. Worldwide, there are only eleven com ...

Read more

Inpsyde is a WooExperts Gold Partner of WooCommerce

by Michael Firnkes

A few weeks ago, Inpsyde GmbH with MarketPress became a certified WooExperts Gold Partner. This is confirmation from WooThemes of our agency’s know-h ...

Read more

BackWPup Pro: Secure WordPress Backup with Google Drive

by Michael Firnkes

The Pro version of our BackWPup plugin supports the backup of WordPress databases and files to Google Drive. But how do you set something like that up? And ...

Read more