You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is inconvenient to have environment variables only be applied at container build time. This kind of defeats the purpose of environment variables and makes pre-building the container impossible.
By simply removing levelToMonologConst and using the parameters as they are, everything works beautifully at runtime.
The only thing that won't happen is the thrown \InvalidArgumentException if the level is invalid. But validation of environment variables is never done at compile time in any other situation. And this validation was only introduced by #357, which, in my opinion, should not have been accepted.
To avoid a BC-break due to the validation, I'd like to see an option to disable levelToMonologConst. I've checked all monolog handlers that use the level coming from levelToMonologConst and all of them use Monolog\Logger::toMonologLevel to cast the level. There is no need to cast the level in this extension at build time. You might then make that the default behavior in a new major version and drop it eventually.
Would you be open to this change? What arguments are there for still having levelToMonologConst?
Is that validation even a BC-break if it was simply removed? It's not like a missing config validation will make anything stop working.
The text was updated successfully, but these errors were encountered:
This PR was merged into the 3.x-dev branch.
Discussion
----------
Resolve "level" env var at runtime
Resolves#413, #444
Currently, the log level is read when the container built. This means we cannot change a log level at runtime using env vars.
With this change, log level can be modified for a specific command run: `LOG_LEVEL=debug bin/console ...`
~I would like to get some feedbacks before updating tests. I don't know yet what is the best strategy to check the resolution of the values.~
Commits
-------
db45663 Resolve levels at runtime using Monolog's native behavior.
Follow up to #357
It is inconvenient to have environment variables only be applied at container build time. This kind of defeats the purpose of environment variables and makes pre-building the container impossible.
By simply removing
levelToMonologConst
and using the parameters as they are, everything works beautifully at runtime.The only thing that won't happen is the thrown
\InvalidArgumentException
if the level is invalid. But validation of environment variables is never done at compile time in any other situation. And this validation was only introduced by #357, which, in my opinion, should not have been accepted.To avoid a BC-break due to the validation, I'd like to see an option to disable
levelToMonologConst
. I've checked all monolog handlers that use the level coming fromlevelToMonologConst
and all of them useMonolog\Logger::toMonologLevel
to cast the level. There is no need to cast the level in this extension at build time. You might then make that the default behavior in a new major version and drop it eventually.Would you be open to this change? What arguments are there for still having
levelToMonologConst
?Is that validation even a BC-break if it was simply removed? It's not like a missing config validation will make anything stop working.
The text was updated successfully, but these errors were encountered: