Skip to content

DX: Console should not output errors unless verbosity level is high #445

@samdark

Description

@samdark

Description

Currently console commands are outputted like this by default:

❯ make yii test
docker compose -f docker/compose.yml -f docker/dev/compose.yml run --rm app ./yii test
[+]  1/1t 1/11
 ✔ Container app-db-1 Running                                                                                                                                                                    0.0s
Container app-db-1 Waiting
Container app-db-1 Healthy
Container app-app-run-5ad508edd1f4 Creating
Container app-app-run-5ad508edd1f4 Created


  Command "test" is not defined.


#0 /app/vendor/symfony/console/Application.php(298): Symfony\Component\Console\Application->find('test')
#1 /app/vendor/symfony/console/Application.php(195): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Yiisoft\Yii\Console\Output\ConsoleBufferedOutput))
#2 /app/vendor/yiisoft/yii-runner-console/src/ConsoleApplicationRunner.php(112): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Yiisoft\Yii\Console\Output\ConsoleBufferedOutput))
#3 /app/yii(18): Yiisoft\Yii\Runner\Console\ConsoleApplicationRunner->run()
#4 {main}
2026-02-22 07:59:41.335000 [error][application] Symfony\Component\Console\Exception\CommandNotFoundException: Command "test" is not defined. in /app/vendor/symfony/console/Application.php:759 while running console command "unknown".

Message context:

trace:

time: 1771747181.335032
memory: 5520824
category: 'application'
exception: Symfony\Component\Console\Exception\CommandNotFoundException: Command "test" is not defined. in /app/vendor/symfony/console/Application.php:759
Stack trace:
#0 /app/vendor/symfony/console/Application.php(298): Symfony\Component\Console\Application->find('test')
#1 /app/vendor/symfony/console/Application.php(195): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Yiisoft\Yii\Console\Output\ConsoleBufferedOutput))
#2 /app/vendor/yiisoft/yii-runner-console/src/ConsoleApplicationRunner.php(112): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Yiisoft\Yii\Console\Output\ConsoleBufferedOutput))
#3 /app/yii(18): Yiisoft\Yii\Runner\Console\ConsoleApplicationRunner->run()
#4 {main}

That is because in config/common/di/logger.php there is StreamTarget::class outputs all levels regardless of verbosity v|vv|vvv, --verbose. Ideally, by default in console it should react to verbosity flags to change log output levels.

Package version

No response

PHP version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions