Installing drupal 8 core (using standard profile). whenever I get exception/error, I get blank page with "The website has encountered an error. Please try again later." (as below image) text and no details/trace about error.

enter image description here

10 Answers 10


On a development site I would suggest uncommenting the following lines in the settings.php file. emacs sites/default/settings.php

if (file_exists(__DIR__ . '/settings.local.php')) {
  include __DIR__ . '/settings.local.php';

and then copying the file example.settings.local.php from /sites folder to /sites/default folder and rename it to settings.local.php

cp sites/example.settings.local.php sites/default/settings.local.php

In addition to adding the following setting

$config['system.logging']['error_level'] = 'verbose';

it also adds a few other settings which will help you in debugging and making development easier. If you don't want any of them in particular, you can always comment them out.

Note : If you think adding a file_exists call to each page will slow down the site, you can always remove it in the production code.

  • If you don't have an example file, you can also just create a file containing <?php $config[...; Feb 20, 2016 at 0:24
  • 1
    As mentioned below the Devel module can make things easier for Drupal 8. Verified that the $config['system.logging']['error_level'] = 'verbose'; settings appears to work. May 2, 2017 at 16:41
  • I have created a docker container that comes with the necessary settings for debugging and non-caching - hope it's useful: hub.docker.com/r/feikede/drupal-dev Sep 17, 2018 at 11:00

Add the following line in the settings.php file.

$config['system.logging']['error_level'] = 'verbose';

See Make developer tricks / tools for D8 more discoverable/obvious for more details.


An easy option, if you have access to Drupal Console, is to enable the development/debugging environment using drupal site:mode dev; when you are ready to change it back to production, use drupal site:mode prod.

  • 1
    Nice trick with the Drupal Console Mar 2, 2017 at 20:43
  • Didn't know you could do this! w00t! Jan 8, 2020 at 10:06
  • 6
    Is there something similar for drush?
    – Benedikt
    Feb 9, 2020 at 9:26

Here is the variable with the different values :

$config['system.logging']['error_level'] = 'all'; // hide|some|all|verbose

These error levels are defined in the Drupal Core Bootstrap, here is the details for each one :

 * Error reporting level: display no errors.
const ERROR_REPORTING_HIDE = 'hide';

 * Error reporting level: display errors and warnings.

 * Error reporting level: display all messages.

 * Error reporting level: display all messages, plus backtrace information.
  • 5
    Thanks for adding the possible values.
    – plocks
    Mar 18, 2019 at 13:10
  • 4
    Yes, thanks for adding the possible values, which were surprisingly difficult to find.
    – arnoldbird
    May 7, 2019 at 14:09
  • @arnoldbird The fact that you were surprised tells me that you hadn't been a Drupal developer for very long when you wrote that comment LOL :P But yes, incredibly difficult to find and thank you @FloDevelop!
    – Kenny83
    Apr 15, 2020 at 6:28
  • @flo-develop any chance anyone can define the "some" option? Or a link to documentation?
    – zkent
    Jul 29, 2021 at 15:14
  • 1
    Hello @zkent, i update my answer with details for each error level. Aug 2, 2021 at 7:31

To get basic error messages in Drupal 8 you don't need to touch any code at all. Just go to:


and set "Error Messages to Display" to an appropriate level.

You can also view your recent errors through the admin interface:


That said, other answers about settings files are relevant – you should only ever make errors visible on your development site, not production.

Overwritten $config objects/keys in settings.php won't be written to the sync directory when exporting, so providing your settings.php is in .gitignore, you can continue to safely use the configuration system to sync between clones of the same site.


You can also install the the Devel and Devel kint modules. This will let you debug using kint(xyz).


If you only have access to Drush (no Drupal console) and you are working on a remote server, you can set the config to show all errors:

drush MYSITE.MYENV config-set system.logging error_level all -y

This is useful if you are getting a WSOD on a remote server and can't troubleshoot without more info.

  • For the situation described I also highly recommend drush sqlc followed by SELECT * FROM watchdog ORDER BY wid DESC LIMIT 1 to show the last entry in the dblog.
    – Gogowitsch
    Aug 9, 2018 at 19:49

Blank page with "The website has encountered an error. Please try again later." won't take you anywhere. To get more information out of your Drupal 8 site you can enable following configs.

$config['system.logging']['error_level'] = 'verbose';

For local Drupal 8 development, you should also enable error reporting, display errors and display startup error to help you further debugging and fixing major runtime error.

ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

You can find more information about TWIG debugging and enabling debugging with Drupal Console in the blog post below.



To enable debugging follow the article: https://www.codeproject.com/Tips/5246457/Enable-Debugging-in-Twig-templates-Drupal-8


Why The website has encountered an error. Please try again later. And not the actual error logs. Simply adding this line

$config['system.logging']['error_level'] = 'verbose';

to your sites/default/settings.php should resolve the issue.

But I will suggest these steps. Assuming I have installed my drupal in /home/drupal/

==enable twig debug and disable cache for development purpose==

cd /home/drupal/web/sites

#1 copy sites/example.settings.local.php to sites/default/settings.local.php

cp example.settings.local.php /home/drupal/web/sites/default/settings.local.php

#2 un-comment this line in the settings.local.php (#) $settings['cache']['bins']['render'] = 'cache.backend.null';

nano /home/drupal/web/sites/default/settings.local.php

#Save all by pressing: Ctrl + X enter Y and press enter

#3 go to site/default/settings.php uncomment this lines 807 to 809

(#) if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
(#)   include $app_root . '/' . $site_path . '/settings.local.php';
(#) }

nano /home/drupal/web/sites/default/settings.php

#Save all by pressing: Ctrl + X enter Y and press enter

#4 edit sites/development.services.yml

nano /home/drupal/web/sites/development.services.yml

#==>> consider tabs and indentation this is a YML file, it requires indentation.

  http.response.debug_cacheability_headers: true
    debug: true
    auto-reload: true
    cache: false
    class: Drupal\Core\Cache\NullBackendFactory

when all steps completed change directory to root dir and rebuild cache

cd /home/drupal/

drush cr

Refresh your site, and you should see the debug outputs, don't forget to undo them before deploying to production.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.