Debug mode

When developing with BlueMvc, it can be useful to enable debug mode.

In this mode, a verbose error message will be displayed when an uncaught exception is thrown, for example:

Error was thrown

Detect debug mode

It is possible to detect whether debug mode is enabled via the Application instance.

This can be helpful if you want your application to behave differently when developing (e.g. show extra information, change log level and more).

// Returns true if debug mode is enabled, false otherwise. $application->isDebug();

Enable debug mode

Debug mode will be enabled if the environment variable BLUEMVC_DEBUG is set (to any value).

How this is done depends on the web server used.

Debug mode should not be enabled on a production server.

Apache

Add the following line to the configuration:

SetEnv BLUEMVC_DEBUG 1

Nginx

Add the following line to the configuration:

fastcgi_param BLUEMVC_DEBUG 1;

IIS

See the IIS documentation on environment variables.

✎ Published in category core