Skip to content

Conversation

@rabbitlair
Copy link

Description

Adds --show-drupal-logs option to core:cron command to display Drupal watchdog logs generated during cron execution without Drush bootstrap noise.

Fixes #6515

Changes

  • Added Connection dependency injection to DrupalCommands
  • Added --show-drupal-logs, --log-severity, and --log-type options
  • Implemented getLastWatchdogId() to capture pre-cron state
  • Implemented displayCronLogs() to query and format watchdog entries
  • Implemented formatLogMessage() to process log variables
  • Added dblog module validation

New Features

# Display all logs from cron execution
drush core:cron --show-drupal-logs

# Filter by severity (warning and above)
drush core:cron --show-drupal-logs --log-severity=4

# Filter by type
drush core:cron --show-drupal-logs --log-type=cron

Testing

  • Code style compliance (composer cs)
  • Static analysis (composer phpstan)

Backwards Compatibility

  • No breaking changes
  • Opt-in functionality via flags
  • Existing behavior unchanged

This adds a new option to display Drupal watchdog logs generated during
cron execution, without the noise from Drush bootstrap.

New options:
- --show-drupal-logs: Enable log display
- --log-severity: Filter by minimum severity (0-7)
- --log-type: Filter by log type (e.g., 'cron', 'php')

Fixes drush-ops#6515
@davereid
Copy link
Contributor

davereid commented Feb 6, 2026

Is it also worth a discussion about potentially rework what --verbose means by default? It's super super verbose and I'd love to be able to use it more often with other commands to see what log messages are happening in Drupal that are not just the "debug" type.

I feel like in my ideal scenario there would be the following options, that generally match the matters I see with other commands and executables:

  • --verbose: Show Drupal log messages if > debug
  • '-vv' Show all Drupal log messages and Drush bootstrapping
  • '-vvv': Above plus more detailed Drush debugging logs?

Then we wouldn't need to special case this command itself, but I know that's a larger issue and I'm not sure if it's been discussed. Just wanted to raise the possibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants