Skip to content

Allow to use env var for log levels of console logger#448

Closed
GromNaN wants to merge 1 commit intosymfony:3.xfrom
GromNaN:log-level-console
Closed

Allow to use env var for log levels of console logger#448
GromNaN wants to merge 1 commit intosymfony:3.xfrom
GromNaN:log-level-console

Conversation

@GromNaN
Copy link
Copy Markdown
Member

@GromNaN GromNaN commented Dec 19, 2022

Following #446

The console logger have a map of verbosity => log level that should be configurable with env vars.

Disadvantage: in case of invalid log level, the exception cannot be contextualized with the output verbosity.

The tests in this PR will conflict with #439

Comment thread DependencyInjection/Configuration.php Outdated
$level = Logger::toMonologLevel(is_numeric($level) ? (int) $level : $level);
}
} catch (\Psr\Log\InvalidArgumentException $e) {
throw new InvalidConfigurationException(sprintf(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep this validation, we could evaluate the value at build time, but pass the configured value (with env placeholder).

https://github.com/symfony/monolog-bundle/pull/446/files#diff-3ee12206c3b122be4593dbfdb19397c16b3d337f759fad3bde6c785d6f1261c0L50-L75

@GromNaN GromNaN changed the base branch from 4.x to 3.x September 24, 2025 08:18
@GromNaN
Copy link
Copy Markdown
Member Author

GromNaN commented Sep 24, 2025

Closing as this this removes the validation during the build time. The new only_interactive option would solve the initial issue I had with having a "console" only when running the command manually.

@GromNaN GromNaN closed this Sep 24, 2025
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