Logger misconfigured for Drush 12

Created on 16 July 2024, 5 months ago

Problem/Motivation

With Drupal 12, setting logger to random drupal logger factory is not supported since DrushCommand::getLogger() is typed.

This is causing confusion for Pantheon support agents that rely on commands like drush search_api_pantheon:diagnose.

Steps to reproduce

Run almost any of the drush commands provided by the module

Proposed resolution

Stop over-writing $logger with a custom instance.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Active

Version

8.1

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)

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

Merge Requests

Comments & Activities

  • Issue created by @nickdickinsonwilde
  • Status changed to Needs review 5 months ago
  • πŸ‡¨πŸ‡¦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)
  • Status changed to RTBC 4 months ago
  • heddn Nicaragua

    Fixes the issue. I'm seeing this with Drush 13 that was just released.

  • πŸ‡¨πŸ‡¦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)
  • πŸ‡¨πŸ‡¦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)

    Yeah would expect that, thanks for confirming Lucas

  • πŸ‡ͺπŸ‡¨Ecuador jwilson3

    Just a note that it looks like a commit was added as part of the solution on πŸ› Error when trying to access Pantheon Search Admin page Active in release 8.1.10 that may fix this issue in another way, but I'm not entirely certain:

    https://git.drupalcode.org/project/search_api_pantheon/-/merge_requests/...

  • πŸ‡¨πŸ‡·Costa Rica rigoucr

    Hello, even when I applied the current merge request to the module , I still having this issue the following issue,
    Drupal version : 10.3.10
    Search api Pantheon: 8.2.2
    Drush version : 13

     [error]  TypeError: Drush\Commands\DrushCommands::logger(): Return value must be of type ?Drush\Log\DrushLoggerManager, Drupal\Core\Logger\LoggerChannel returned in Drush\Commands\DrushCommands->logger() (line 77 of /app/vendor/drush/drush/src/Commands/DrushCommands.php) #0 /app/vendor/drush/drush/src/Runtime/ServiceManager.php(480): Drush\Commands\DrushCommands->logger()
    #1 /app/vendor/drush/drush/src/Boot/DrupalBoot8.php(282): Drush\Runtime\ServiceManager->inflect(Object(League\Container\Container), Object(Drupal\search_api_pantheon\Commands\Reload))
    #2 /app/vendor/drush/drush/src/Boot/DrupalBoot8.php(218): Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands(Object(Drush\Boot\BootstrapManager))
    #3 /app/vendor/drush/drush/src/Boot/BootstrapManager.php(211): Drush\Boot\DrupalBoot8->bootstrapDrupalFull(Object(Drush\Boot\BootstrapManager), NULL)
    #4 /app/vendor/drush/drush/src/Boot/BootstrapManager.php(397): Drush\Boot\BootstrapManager->doBootstrap(5, 6, NULL)
    #5 /app/vendor/drush/drush/src/Application.php(219): Drush\Boot\BootstrapManager->bootstrapMax()
    #6 /app/vendor/drush/drush/src/Application.php(185): Drush\Application->bootstrapAndFind('cr')
    #7 /app/vendor/symfony/console/Application.php(266): Drush\Application->find('cr')
    #8 /app/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #9 /app/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #10 /app/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
    #11 /app/vendor/drush/drush/drush.php(140): Drush\Runtime\Runtime->run(Array)
    #12 /app/vendor/bin/drush.php(119): include('/app/vendor/dru...')
    #13 {main}.
    TypeError: Drush\Commands\DrushCommands::logger(): Return value must be of type ?Drush\Log\DrushLoggerManager, Drupal\Core\Logger\LoggerChannel returned in /app/vendor/drush/drush/src/Commands/DrushCommands.php on line 77 #0 /app/vendor/drush/drush/src/Runtime/ServiceManager.php(480): Drush\Commands\DrushCommands->logger()
    #1 /app/vendor/drush/drush/src/Boot/DrupalBoot8.php(282): Drush\Runtime\ServiceManager->inflect(Object(League\Container\Container), Object(Drupal\search_api_pantheon\Commands\Reload))
    #2 /app/vendor/drush/drush/src/Boot/DrupalBoot8.php(218): Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands(Object(Drush\Boot\BootstrapManager))
    #3 /app/vendor/drush/drush/src/Boot/BootstrapManager.php(211): Drush\Boot\DrupalBoot8->bootstrapDrupalFull(Object(Drush\Boot\BootstrapManager), NULL)
    #4 /app/vendor/drush/drush/src/Boot/BootstrapManager.php(397): Drush\Boot\BootstrapManager->doBootstrap(5, 6, NULL)
    #5 /app/vendor/drush/drush/src/Application.php(219): Drush\Boot\BootstrapManager->bootstrapMax()
    #6 /app/vendor/drush/drush/src/Application.php(185): Drush\Application->bootstrapAndFind('cr')
    #7 /app/vendor/symfony/console/Application.php(266): Drush\Application->find('cr')
    #8 /app/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #9 /app/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #10 /app/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
    #11 /app/vendor/drush/drush/drush.php(140): Drush\Runtime\Runtime->run(Array)
    #12 /app/vendor/bin/drush.php(119): include('/app/vendor/dru...')
    #13 {main}
    TypeError: Drush\Commands\DrushCommands::logger(): Return value must be of type ?Drush\Log\DrushLoggerManager, Drupal\Core\Logger\LoggerChannel returned in Drush\Commands\DrushCommands->logger() (line 77 of /app/vendor/drush/drush/src/Commands/DrushCommands.php).
    

    So I belive this stills needing some work.

  • πŸ‡ΊπŸ‡ΈUnited States anilu@ Houston, TX

    Same issue for me,
    Drupal version 10.3.10
    Drush 13
    Search Api Pantheon ^8.2

    I applied the patch with composer and I get the same error

    lando drush en devel
    TypeError: Drush\Commands\DrushCommands::logger(): Return value must be of type ?Drush\Log\DrushLoggerManager, Drupal\Core\Logger\LoggerChannel returned in /app/vendor/drush/drush/src/Commands/DrushCommands.php on line 77 #0 /app/vendor/drush/drush/src/Runtime/ServiceManager.php(480): Drush\Commands\DrushCommands->logger()
    #1 /app/vendor/drush/drush/src/Boot/DrupalBoot8.php(282): Drush\Runtime\ServiceManager->inflect(Object(League\Container\Container), Object(Drupal\search_api_pantheon\Commands\Reload))
    #2 /app/vendor/drush/drush/src/Boot/DrupalBoot8.php(218): Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands(Object(Drush\Boot\BootstrapManager))
    #3 /app/vendor/drush/drush/src/Boot/BootstrapManager.php(211): Drush\Boot\DrupalBoot8->bootstrapDrupalFull(Object(Drush\Boot\BootstrapManager), NULL)
    #4 /app/vendor/drush/drush/src/Boot/BootstrapManager.php(397): Drush\Boot\BootstrapManager->doBootstrap(5, 6, NULL)
    #5 /app/vendor/drush/drush/src/Application.php(219): Drush\Boot\BootstrapManager->bootstrapMax()
    #6 /app/vendor/drush/drush/src/Application.php(185): Drush\Application->bootstrapAndFind('pm:install')
    #7 /app/vendor/symfony/console/Application.php(266): Drush\Application->find('pm:install')
    #8 /app/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #9 /app/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #10 /app/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
    #11 /app/vendor/drush/drush/drush.php(140): Drush\Runtime\Runtime->run(Array)
    #12 /app/vendor/bin/drush.php(119): include('/app/vendor/dru...')
    #13 {main}
    TypeError: Drush\Commands\DrushCommands::logger(): Return value must be of type ?Drush\Log\DrushLoggerManager, Drupal\Core\Logger\LoggerChannel returned in Drush\Commands\DrushCommands->logger() (line 77 of /app/vendor/drush/drush/src/Commands/DrushCommands.php).
     [warning] Drush command terminated abnormally.
  • πŸ‡ΊπŸ‡ΈUnited States anilu@ Houston, TX
  • πŸ‡ΊπŸ‡ΈUnited States anilu@ Houston, TX

    I tried changing the module to the previous version and got an error when apliying the patch. I think this is cause to merging conflicts.

    The fork was created from 8.1 and not from 8.x so I am not sure how to update the code to work with the last version of the code. I will keep looking into it during the week. If someone has an idea on how to fix the PR I will appreciated.

    Mean while the remaning work will be to create a new branch from 8.x and applied the same changes as in https://git.drupalcode.org/project/search_api_pantheon/-/merge_requests/...

  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States camoa

    camoa β†’ changed the visibility of the branch 8.2.x to hidden.

  • πŸ‡ΊπŸ‡ΈUnited States camoa

    camoa β†’ changed the visibility of the branch 8.2.x to hidden.

  • πŸ‡ΊπŸ‡ΈUnited States camoa

    camoa β†’ changed the visibility of the branch 8.2.x to hidden.

  • πŸ‡ΊπŸ‡ΈUnited States camoa

    I was working on rebasing the 8.2.x branch, made some mistakes but fixed it at the end. The new branch 3461920-logger-misconfigured-8.2.x should work for the 8.2.2 version of the module.

    I did not review the changes made by the original committer, I just rebased the 8.2.x Branch

    Usage (while this gets approved):

    Add the patch in your composer.json

    - If you are using 8.1.x use the merge request #10
    - If you are using the 8.2.x version, use merge request #13

  • πŸ‡ΊπŸ‡ΈUnited States camoa

    Setting to needs review

  • πŸ‡ΊπŸ‡ΈUnited States anilu@ Houston, TX

    I tested MR !13 on a client project and did not work. I keep getting the TypeError: Drush\Commands\DrushCommands::logger(): error

    I tried to fix the Mr and created an issue directly in gihub as required in the module documentation https://github.com/pantheon-systems/search_api_pantheon/issues/200

Production build 0.71.5 2024