Debugging Bright For WordPress

wp-config.php

In development, we highly recommend adding the following to your wp-config.php

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', true);

The location of your debugging log is dependent on your php.ini settings.

Bright Debugging

Bright includes its own debug functionality which includes some special functionality. You can use the setting for wp-config.php above to view bright debugging statements in the WordPress debug.log file [in wp-content].

bright_log()

Additionally, if you configure the following in wp-config.php:

 /* echo bright_log() statements into the response if brightdebug is part of the request URI */
 define('BRIGHT_DEBUG',true);

You can view bright_log() statements in the response page.

Recommended Production Settings

wp-config.php

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false); /* keep nasty stack traces OFF the user's page */
define('BRIGHT_DEBUG', true);
define('BRIGHT_DEBUG_KEY','[YOURDEBUGKEY]'); /* for per page debugging */
ini_set( 'error_log', '[a-secure-directory]/bright.log' );

maybe:

ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );

But make sure you secure this [see below].

Note starting in Bright Plugin Version 9.5, Bright Options as follows need to be set:

log_curl=true&logging=true

Some Bright versions pre-9.5 had logging disabled. If you set up your wp-config.php and get no logging, upgrade to a post 9.5+ version and use the Bright options as above.

Securing a log file in production

If you leave your log file under wp-content, note you should restrict access to it by placing an .htaccess file [apache] in this directory:

<Files "*.log">
Order Allow,Deny
Deny from all
</Files>

Viewing per request debugging data

If BRIGHT_DEBUG=[YOURDEBUGKEY], you can add the following to your URL:

brightdebug=[THE CONFIGURED BRIGHT_DEBUG_KEY from wp-config.php]

Important - Don\'t transmit your debugging key over an insecure wire, like over HTTP or off an insecure network.

The BRIGHT_DEBUG_KEY is required to disable the casual use of this feature ... therefore we recommend it only be used over a secure [https/ssl] channel.

And view debugging right in the page.

See Also

Debugging Bright Embedder Templates