Skip to main content

How to Enable Error logs - Drupal

Updated over a week ago

This article explains how to enable detailed error logging in Drupal 8, 9, and 10.

⚠️ Always disable debug mode after troubleshooting is complete.

Prerequisites

  • Access to cPanel

  • Ensure PHP error logging is enabled in cPanel

Completion of the task: 10 minutes

Expertise: advanced

Enable Error Reporting from Admin Panel

  1. Log in to the Drupal Administrator

  2. Navigate to Configuration > Development > Logging and errors

  3. Set Error messages to display to All messages.

  4. Save configuration.

Where to View Logs

Reports > Recent log messages

Stored in database table: watchdog (access via SSH)

# view recent messages 
drush ws
drush watchdog:show
drush watchdog:show --count=10

# View a specific log entry in detail
drush ws [ID]

# tail logs
drush watchdog-show --tail
drush watchdog:tail

# Mysql query - display the last 10 entries
SELECT * FROM watchdog ORDER BY wid DESC LIMIT 10;


Enable Verbose Logging via settings.php

  1. Edit sites/default/settings.php file

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

Disable Debugging

Set error messages back to None or Errors and warnings after troubleshooting.

Did this answer your question?