Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class Consolidation\Log\ConsoleLogLevel not found in Drush\Log\DrushLoggerManager->success() #31

Closed
gitressa opened this issue Aug 5, 2022 · 3 comments

Comments

@gitressa
Copy link

gitressa commented Aug 5, 2022

Describe the bug
After the removal of https://github.com/consolidation/log/commits/3.x/src/ConsoleLogLevel.php (see also #20) I get an error at the very end after installing Drupal 10 Alpha 7 with Lando running PHP 8.1, or after every command which should end with a [notice] Successfully ... message.

I found https://drupal.stackexchange.com/questions/311778/uncaught-error-class-consolidation-log-loglevel-not-found-in-app-vendor-con so I restored https://github.com/consolidation/log/blob/2.x/src/ConsoleLogLevel.php changing const SUCCESS = 'success'; to const SUCCESS = 'notice'; and everything works fine, and I get the expected messages, such as:

$ drush un ban
 [notice] Successfully uninstalled: ban

To Reproduce

$ composer create-project drupal/recommended-project:^10@alpha d10alpha7
$ cd d10alpha7/
$ lando init --recipe drupal10 --name d10 --source cwd --webroot web php --option php='8.1' && lando start
$ composer require drush/drush
$ drush site:install --db-url=mysql://drupal10:drupal10@database/drupal10 -y

 You are about to:
 * DROP all tables in your 'drupal10' database.

 // Do you want to continue?: yes.                                                                                      

 [notice] Starting Drupal installation. This takes a while.
 [notice] Performed install task: install_select_language
 [notice] Performed install task: install_select_profile
 [notice] Performed install task: install_load_profile
 [notice] Performed install task: install_verify_requirements
 [notice] Performed install task: install_verify_database_ready
 [notice] Performed install task: install_base_system
 [notice] Performed install task: install_bootstrap_full
 [notice] Performed install task: install_profile_modules
 [notice] Performed install task: install_profile_themes
 [notice] Performed install task: install_install_profile
 [notice] Performed install task: install_configure_form
 [notice] Performed install task: install_finished
 [error]  Error: Class "Consolidation\Log\ConsoleLogLevel" not found in Drush\Log\DrushLoggerManager->success() (line 12 of /app/vendor/drush/drush/src/Log/DrushLoggerManager.php) #0 /app/vendor/drush/drush/src/Commands/core/SiteInstallCommands.php(161): Drush\Log\DrushLoggerManager->success('Installation co...')
#1 [internal function]: Drush\Commands\core\SiteInstallCommands->install('standard', Array)
#2 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#3 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#4 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#5 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(350): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#6 /app/vendor/symfony/console/Command/Command.php(308): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /app/vendor/symfony/console/Application.php(1016): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /app/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /app/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /app/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /app/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /app/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#13 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')
#14 /app/vendor/bin/drush(120): include('/app/vendor/dru...')
#15 {main}. 
Error: Class "Consolidation\Log\ConsoleLogLevel" not found in /app/vendor/drush/drush/src/Log/DrushLoggerManager.php on line 12 #0 /app/vendor/drush/drush/src/Commands/core/SiteInstallCommands.php(161): Drush\Log\DrushLoggerManager->success('Installation co...')
#1 [internal function]: Drush\Commands\core\SiteInstallCommands->install('standard', Array)
#2 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#3 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#4 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#5 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(350): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#6 /app/vendor/symfony/console/Command/Command.php(308): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /app/vendor/symfony/console/Application.php(1016): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /app/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /app/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /app/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /app/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /app/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#13 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')
#14 /app/vendor/bin/drush(120): include('/app/vendor/dru...')
#15 {main}
Error: Class "Consolidation\Log\ConsoleLogLevel" not found in Drush\Log\DrushLoggerManager->success() (line 12 of /app/vendor/drush/drush/src/Log/DrushLoggerManager.php).
 [warning] Drush command terminated abnormally.

Expected behavior
A success message, after running a Drush command.

Actual behavior
I got an error.

Workaround

  1. Restore https://github.com/consolidation/log/blob/2.x/src/ConsoleLogLevel.php
  2. Change:
    const SUCCESS = 'success';
    To:
    const SUCCESS = 'notice';

System Configuration

Q A
Drush version? 11.x
Drupal version? 10.x
PHP version 8.x
OS? Linux
$ drush st
Drupal version   : 10.0.0-alpha7                     
Site URI         : http://default                    
DB driver        : mysql                             
DB hostname      : database                          
DB port          :                                   
DB username      : drupal10                          
DB name          : drupal10                          
Database         : Connected                         
Drupal bootstrap : Successful                        
Default theme    : olivero                           
Admin theme      : claro                             
PHP binary       : /usr/local/bin/php                
PHP OS           : Linux                             
Drush script     : /app/vendor/bin/drush             
Drush version    : 11.1.1                            
Drush temp       : /tmp                              
Drush configs    : /app/vendor/drush/drush/drush.yml 
Install profile  : standard                          
Drupal root      : /app/web                          
Site path        : sites/default                     
Files, Public    : sites/default/files               
Files, Temp      : /tmp                              
$ lando info | grep -A 1 php.ini
  config: { php: '/home/user/.lando/config/drupal10/php.ini' },
  version: '8.1',

Additional information
Add any other context about the problem here.

@greg-1-anderson
Copy link
Member

ConsolidationLogLevel still exists on 2.x versions of consolidation/log. Versions of Drush that use this class should be requiring consolidation/log ^2, and should not allow consolidation/log ^3. Is this not the case?

Looks like Drush still uses it: https://github.com/drush-ops/drush/blob/11.x/src/Log/DrushLoggerManager.php#L12

It also looks like Drush does not have a direct dependency on consolidation/log, and accepts any versions that its dependencies require.

Looks like a Drush bug. I'm not sure why the unit tests are not failing.

@gitressa
Copy link
Author

I have created a merge request which restores the /src/ConsoleLogLevel.php file as outlined under Workaround above. I have no idea if it's the right solution, but it gets rid of the error messages and restores the normal feedback messages.

@greg-1-anderson
Copy link
Member

I believe this was resolved in drush-ops/drush#5213 as referenced above.

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 a pull request may close this issue.

2 participants