Drupal Errors: Display Errors, Read Logs, and Find the Real Failure

If your Drupal site says "The website encountered an unexpected error. Try again later.", do not start by editing random Twig files. Start by collecting the exact failure: the error-display setting, the Recent log messages row, the Status report, and the route or screen that triggered it. We reproduced the workflow in Drupal 11.3.8 on Docker and captured the screens below.

mysite.com/simplereview-error-lab
SimpleReview
Manage ReportsConfigurationadmin
Reports
Configuration
Extend

Drupal error

The website encountered an unexpected error. Try again later.

Recent log messages
TypeMessage
phpRuntimeException in ErrorLabController
customControlled runtime exception logged
Comment
find the Drupal error and prepare a fix
Fix it
Drupal logs detected
Evidence
Generic error page, dblog row, and Status report captured before changes.
Boundary
Custom module controller throws RuntimeException. No schema or migration touched.
Site fix
Patch the controller, keep production error display hidden, verify on staging.
Capture the Drupal error -> read Recent log messages -> prepare a bounded site-ready fix
Search intent signal: people looking for Drupal error help are usually not asking for a generic "clear cache" answer. They need to know where to display the error safely, where Drupal stores recent log messages, and when the log is enough to prepare a bounded site fix.

What we actually tested

  • Installed Drupal 11.3.8 from the official drupal:11-apache Docker image with PostgreSQL 16 and Drush 13.7.2.
  • Enabled Drupal core Database Logging (dblog).
  • Created a tiny local custom module route at /simplereview-error-lab that throws a controlled RuntimeException.
  • Captured the generic public error page, Logging and errors settings, Recent log messages, and Status report.
Drupal generic unexpected error page captured from a controlled Drupal 11 Docker route.
The public screen is intentionally vague. This is why "display errors" is a diagnostic step, not the fix.

The safe debugging order

Use this order when Drupal shows a generic error page or a blank screen. It keeps production safe and turns "Drupal is broken" into a concrete fix brief.

  1. Do not enable verbose errors publicly first. If the site is live, reproduce on local or staging. Verbose output can expose paths, class names, query details, and module structure.
  2. Check Status report. It tells you whether the install is already unhealthy: cron, trusted host, filesystem, PHP extensions, update status, or database warnings.
  3. Open Recent log messages. If dblog is enabled, use /admin/reports/dblog. Filter by severity and type. If the site is too broken for the UI, use Drush watchdog commands.
  4. Only then change error display. Drupal documents hide, some, all, and verbose. Switch temporarily, collect the trace, then switch back.
  5. Map the trace to the boundary. Theme/Twig, config, custom module, contributed module, environment, or database migration all have different risk.
Drupal 11.3.8 Status report screen showing errors, warnings, checked items, Drupal version, web server, and last cron run.
Real Drupal 11.3.8 Status report from the Docker lab. If this screen is already red, treat the task as diagnosis before code editing.

How to display Drupal errors without leaking production details

Drupal's official verbose logging page says the browser UI is under /admin/config/development/logging. The same setting can be changed with Drush:

vendor/bin/drush config:set system.logging error_level verbose -y
vendor/bin/drush cr

For local development, Drupal's docs also mention PHP-level display settings such as error_reporting(E_ALL) and ini_set('display_errors', TRUE). Keep that distinction clear:

SettingUse it forDo not use it for
hideProduction defaultDebugging a hidden exception without logs
some / allStaging reproduction where users cannot see outputPublic traffic
verboseShort local/staging trace captureLong-lived live-site setting
PHP display_errorsLocal PHP runtime diagnosisShared production hosting
Drupal 11 Logging and errors configuration screen showing error message display options and database log retention.
Real Logging and errors screen. This lab is set to "None", which is the sane production posture before you inspect logs.

Read Recent log messages before changing code

The Drupal Database Logging docs say dblog records events in the database and exposes them at /admin/reports/dblog. That page is the bridge between the generic public error and the actual failing component.

In our lab, the public page only showed the generic sentence. The log showed a PHP RuntimeException and a custom simplereview_error_lab entry. That is enough to avoid editing unrelated templates or clearing cache repeatedly.

Drupal 11 Recent log messages screen showing a PHP RuntimeException and a custom simplereview_error_lab log entry.
Real Recent log messages screen after triggering the controlled exception. The route is broken, but the cause is now concrete.

When SimpleReview can prepare the fix

SimpleReview is a fit when the evidence points to a bounded change:

The workflow is: capture the screen, capture the log row, let SimpleReview prepare a site-ready fix, verify on staging, then return production error display to hidden.

When to hire a Drupal developer instead

Bring in a Drupal developer when the log points to migration, schema, database state, security, or infrastructure ownership. Examples:

Rule of thumb: SimpleReview is for bounded site fixes. A human developer is for unknown state, high blast radius, and production ownership.

Copy-paste checklist

# 1. On staging/local, enable verbose Drupal error output temporarily.
vendor/bin/drush config:set system.logging error_level verbose -y
vendor/bin/drush cr

# 2. Reproduce the failing URL once.
curl -I https://example.com/the-broken-path

# 3. Read recent watchdog messages.
vendor/bin/drush watchdog:show --count=20

# 4. Put production-style display back.
vendor/bin/drush config:set system.logging error_level hide -y
vendor/bin/drush cr

Turn the Drupal error into a fix brief

Capture the failing screen and log row, then let SimpleReview prepare a bounded site-ready fix for review.

Install SimpleReview

Related

Sources