Version 5 supported


Silverstripe CMS can be a large and complex framework to debug, but there are ways to make debugging less painful. In this guide we show the basics on defining the correct Environment Type for your application and other built-in helpers for dealing with application errors.

Environment Types
Configure your Silverstripe CMS environment to define how your web application behaves.
Logging and Error Handling
Trap, fire and report diagnostic logs, user exceptions, warnings and errors.
URL Variable tools
Useful debugging tools you can use right in the browser
Template debugging
Track down which template rendered a piece of html


See the Profiling documentation for more information on profiling Silverstripe CMS to track down bottle-necks and identify slow moving parts of your application chain.

Debugging utilities

The Debug class contains a number of static utility methods for more advanced debugging.

use SilverStripe\Dev\Backtrace;
use SilverStripe\Dev\Debug;

// similar to print_r($myVariable) but shows it in a more useful format.

Debug::message("Wow, that's great");
// prints a short debugging message.

// prints a calls-stack

Debugging database queries

You can opt in to including a comment on all ORM queries indicating where the query was executed by setting the DBQueryBuilder.trace_query_origin configuration property or the SS_TRACE_DB_QUERY_ORIGIN environment variable to true.

Note that the environment variable, if set, will take precedence over the configuration property value.

This is useful if you're using a database proxy, or if you're using the showqueries URL variable.

API documentation