-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
strange configuration parsing of monolog, ??? BC-break after release of 3.4.0 ??? #309
Comments
The problem is that in monolog:
channels: ["cron", "slow"]
handlers:
main:
type: fingers_crossed
buffer_size: 1000
action_level: warning
handler: nested
excluded_404s:
- ^/
nested:
type: stream
# ... and in monolog:
handlers:
main:
# change "fingers_crossed" handler to "group" that works as a passthrough to "nested"
type: group
members: [ nested ] I've failed to empty the Not sure if I'm missing something obvious or this change really broke our config. If so, we'd have to stop changing the |
I've been missing something. An mergable configuration can be unset using |
The change in #271 might not be a BC break per-se, but it can complicate things for the users as seen above. Personally, I'm in favor of being a bit more restrictive in configuration and rather throw an exception when an invalid state is detected, so I don't mind the complications as they force users to correct usage... |
Looks like the same type of error after 3.4 upgrade :
|
+1 |
1 similar comment
+1 |
I managed to reproduce it. Everything is well explained in this comment And the following fix makes your application working (and more robust)
thanks @PetrHeinz I don't think we can do anything here. using So you should unset the configuration that are not compatible with your handler:
|
I have the same issue with |
Could you create a reproducer? Thanks |
OK, so the result is that it is not a part of the BC-promise or it is importnant BC-break that should be introduced also in minor? |
This is not covered by the BC promise |
now i see, OK THX. |
I don't get the point, it breaks existing applications but it's not considered as a BC break ? I understand it can be easily fixed, but what the point of using semver in this case. |
as i understand it and also experienced it is a BC-break if it is said it is. You can check the BC-promise list. |
@COil Your usage of MonologBundle was incorrect, and someone added a check to ensure the configuration was correct. |
Here's the reproducer TBH it's not a big deal, it's cleaner to define monolog configs separately per env anyway |
@TamasSzigeti Thanks, I will have a look ASAP |
@lyrixx Thanks for the explanation of your point of view on BC, I tried to explain it similarly in #309 (comment). 👍 Almost every change in code can break some applications. That's why it's important to have a BC Promise. |
ok, ok. I'll give a try this weekend for one of my project. Thank you. |
You application can not boot:
Anyway, let take a step back on this issue. What do you (all) have in mind when you configure monolog globally ( For now, symfony process configuration like following: It loads the global configuration first: monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405] Then it (try to) merges it with the env configuration: monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!event"]
excluded_http_codes: false So this results in something really strange. Which configuration should win? The last one? Why? protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
// ...
// global
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
// per env
$loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob'); But anyway, what should be done? Should we drop all the previous configuration if a new configuration is met with the same name? |
Exactly, "Expected parameter 2 to be an array" shows on false, and As I said, I feel it's better to config it per env, which I have done in our project. Much cleaner. Otherwise yes, the env-specific config should override the global one. The problem here is that it doesn't, null or empty array doesn't override the global one, and false just breaks, as you saw it. |
BTW, by default monolog does not have global configuration, exactly for this |
Correct, it affected our legacy pre-flex project. |
symfony: ^3.4
monolog: 3.4.0
in the case i have something like this
after merge of #271 monolog config is invalid because the parsed configuration is treated as group type instead of fingers_crossed
The text was updated successfully, but these errors were encountered: