Enable verbose error logging
This documentation needs review. See "Help improve this page" in the sidebar.
Sometimes, you can face an unexpected error in a Drupal website, for example during installation, development or updating:
The website encountered an unexpected error. Please try again later.
You can enable backtracing of the error, and display of more information in the message area, via the GUI or by adding a single line in a settings file.
Configure debugging via browser
Navigate to Administration > Configuration > Development Logging and errors > Error messages to display (/admin/config/development/logging) and select the level of Error messages to display (config variable names added for reference):
- None -
hide
- Errors and warnings -
some
- All messages -
all
- All messages, with backtrace information -
verbose
Click "Save configuration"
Configure debugging via Drush
You can enable debugging with Drush as well. See the four possible config variable names above:
drush config:set system.logging error_level verbose -y
Configure debugging via a settings file
Detailed backtracing and message level can also be enabled via a settings file, in one of two ways:
- Add it in a new
settings.local.php
file, creating it by copyingsites/example.settings.local.php
and rename it tosites/default/settings.local.php
. Make suresettings.local.php
file is loading by uncommenting the relevant lines insettings.php
- Add it in
settings.php
Add this:
$config['system.logging']['error_level'] = 'verbose';
Enable display of PHP errors
For local Drupal development, you can also enable error reporting, display errors and display startup error to help you further debugging and fixing major runtime errors:
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion