Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8942999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:39:59+00:00 2026-06-15T11:39:59+00:00

I cannot get the symfony2 configuration to correctly overwrite values from other config-files. Here

  • 0

I cannot get the symfony2 configuration to correctly overwrite values from other config-files. Here is the problem:

I have a new environment “staging” where I want to use most of the stuff from config_prod.yml but have another logging level (I want it to be as it is in development, simply logging everything to a file). Here are the config stuff I use:

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 to the given file. What really happens is that he logs every message twice! The same happens when I use this for the 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, setting the action_level of the main handler to debug and leaving everything else as is, but I don’t like this solution. There must be a way to overwrite config stuff so I only have the main monolog handler.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:40:00+00:00Added an answer on June 15, 2026 at 11:40 am

    Pretty much one year later I now have an understanding of what’s happening and how to prevent it:

    The nested handler is befilled with the configuration from the config.yml and when parsing the config_staging.yml, the yaml component does not overwrite the whole hashmap and set the value to null but tries to merge both, resulting in the same array as before.

    There is a type called null which can be used ot overwrite any Logger. It does nothing and is therefor suitable for this use case:

    monolog:
        handlers:
            main:
                type: stream
                path: %kernel.logs_dir%/%kernel.environment%.log
                level: debug
                handler: ~
            nested: ~
                type: null
    

    Another solution would be to not configure any logging in the config.yml but only in the specific environment configs like config_prod.yml and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cannot get GLEW to link correctly with my program. I have the path
I cannot get my Spring web app to find my scripts. I have the
I cannot get the following route to fire when a url is requested from
I cannot get the Theme.Dialog activity to get smaller. The problem is that i
I need a help in solving my problem with Symfony2. I am quite new
I cannot get a Java application to run correctly when starting it with sudo.
I have a little disturbing problem in here! an using symfony 1.4 with Doctrine!
I cannot get a two-way bind in WPF to work. I have a string
I cannot get my SelectedIndexChanged of my dropdownlist to fire. I have the following:
I cannot get the style width value to display correctly when using inline syntax.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.