2014-09-21 02:07:58 +02:00
|
|
|
summary: Learn how to identify errors in your application and best practice for logging application errors.
|
|
|
|
|
2011-02-07 07:48:44 +01:00
|
|
|
# Debugging
|
|
|
|
|
2014-10-13 10:52:19 +02:00
|
|
|
SilverStripe can be a large and complex framework to debug, but there are ways to make debugging less painful. In this
|
2015-02-28 01:09:15 +01:00
|
|
|
guide we show the basics on defining the correct [Environment Type](environment_types) for your application and other
|
2014-10-13 10:52:19 +02:00
|
|
|
built-in helpers for dealing with application errors.
|
2011-02-07 07:48:44 +01:00
|
|
|
|
2014-10-13 10:52:19 +02:00
|
|
|
[CHILDREN]
|
2011-02-07 07:48:44 +01:00
|
|
|
|
2014-10-13 10:52:19 +02:00
|
|
|
## Performance
|
2011-02-07 07:48:44 +01:00
|
|
|
|
2014-10-13 10:52:19 +02:00
|
|
|
See the [Profiling](../performance/profiling) documentation for more information on profiling SilverStripe to track down
|
|
|
|
bottle-necks and identify slow moving parts of your application chain.
|
2011-02-07 07:48:44 +01:00
|
|
|
|
2014-10-13 10:52:19 +02:00
|
|
|
## Debugging Utilities
|
2011-02-07 07:48:44 +01:00
|
|
|
|
2017-07-03 03:22:12 +02:00
|
|
|
The [Debug](api:SilverStripe\Dev\Debug) class contains a number of static utility methods for more advanced debugging.
|
2011-02-07 07:48:44 +01:00
|
|
|
|
2017-08-07 05:11:17 +02:00
|
|
|
```php
|
2017-10-27 04:38:27 +02:00
|
|
|
use SilverStripe\Dev\Debug;
|
|
|
|
use SilverStripe\Dev\Backtrace;
|
2011-02-07 07:48:44 +01:00
|
|
|
|
2017-10-27 04:38:27 +02:00
|
|
|
Debug::show($myVariable);
|
|
|
|
// similar to print_r($myVariable) but shows it in a more useful format.
|
2011-02-07 07:48:44 +01:00
|
|
|
|
2017-10-27 04:38:27 +02:00
|
|
|
Debug::message("Wow, that's great");
|
|
|
|
// prints a short debugging message.
|
|
|
|
|
|
|
|
Backtrace::backtrace();
|
|
|
|
// prints a calls-stack
|
2017-08-07 05:11:17 +02:00
|
|
|
```
|
2011-02-07 07:48:44 +01:00
|
|
|
|
2014-10-13 10:52:19 +02:00
|
|
|
## API Documentation
|
2012-07-05 23:36:52 +02:00
|
|
|
|
2017-07-03 03:22:12 +02:00
|
|
|
* [Backtrace](api:SilverStripe\Dev\Backtrace)
|
|
|
|
* [Debug](api:SilverStripe\Dev\Debug)
|