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:


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


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



  1. #1

    This is a bad idea — at least, running with WP_DEBUG_LOG so that the log goes to a file accessible from the website. Your website logs should already have much of this, but if you want to set E_ALL and log everything to a file for later review, please send to a file outside your publicly accessible web folders. See this Stack question for example: http://wordpress.stackexchange.com/q/84132/24260

    Also, here’s a gist for a simple plugin to redirect the debug log to /private instead of /public_html or /httpdocs or whatever: https://gist.github.com/webaware/4969753

    • #2

      Hi Ross,

      thanks for your response and the link. I agree printing errors should be avoided for security reasons in general. However, most of our users use shared web hosting and no access to error logs. The solution above should be seen as a “quick and dirty” peek into debug.log which afterwards should be deleted again, of course.

      Kind regards,

  2. #3


    I’m using this code but not seeing a debug.log file appear in wp-contents.

    Do I need to create the file first so it can write to it?

    Could it be a permissions issue?


Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">