I cannot get the symfony2 configuration to overwrite values ββfrom other configuration files correctly. Here is the problem:
I have a new "staging" environment where I want to use most of the material from config_prod.yml, but have a different level of logging (I want it to be what it is in development, just writing everything to a file). Here is the contents of the configuration I am using:
config_prod.yml:
imports: - { resource: config.yml } monolog: handlers: main: type: fingers_crossed action_level: error handler: nested nested: type: stream path: %kernel.logs_dir%/%kernel.environment%.log level: debug
config_staging.yml:
imports: - { resource: config_prod.yml } monolog: handlers: main: type: stream path: %kernel.logs_dir%/%kernel.environment%.log level: debug nested: ~
From my point of view, the nested logger is now null and the main logs for this file. What really happens is that he records every message twice! The same thing happens when I use this for config_staging.yml:
imports: - { resource: config_prod.yml } monolog: handlers: main: type: stream path: %kernel.logs_dir%/%kernel.environment%.log level: debug handler: ~ nested: ~
I found a workaround by setting the action_level of the main handler to debug and leave everything else as it is, but I don't like this solution. There must be a way to overwrite the configuration files, so I only have the main monologue handler.
source share