UltimateCronCommands throws an error under Drush 13

Created on 2 September 2025, about 1 month ago

Problem/Motivation

Using Drush 13, commands fail to run with:

[error] AssertionError: Instead of using replacing Drush's logger, use $this->add() on DrushLoggerManager to add a custom logger. See https://github.com/drush-ops/drush/pull/5022 in assert()

Steps to reproduce

Install Drush 13, Ultimate Cron 2.0-alpha7 (from OpenSocial distribution). Run Drush commands like uli or cr.

Proposed resolution

Replace the constructor in UltimateCronCommands as:

  /**
   * Constructs an UltimateCronCommands object.
   *
   * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger
   *   Logger factory object.
   */
  public function __construct(LoggerChannelFactoryInterface $logger) {
    // Don't replace Drush's logger because it'll cause a fatal error on Drush
    // 13 and newer.
    //
    // @see https://www.drupal.org/project/markdown/issues/3483437
    //
    // @see https://github.com/drush-ops/drush/pull/5022
    if (!method_exists($this, 'logger')) {
      $this->logger = $logger;
    }
  }
πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States kevinquillen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024