3

I can't manage to get a log of the doctrine channel in my prod environment.

I'm using

  • symfony/symfony v2.4.6
  • symfony/monolog-bundle v2.6.0
  • doctrine/common v2.4.2

Here is my monolog config in config_prod.yml:

monolog:
    handlers:
        doctrine:
            bubble: false
            action_level: DEBUG
            type:  stream
            path:  "%kernel.logs_dir%/%kernel.environment%_doctrine.log"
            channels: doctrine
        security:
            bubble: false
            action_level: DEBUG
            type:  stream
            path:  "%kernel.logs_dir%/%kernel.environment%_security.log"
            channels: security
        request:
            bubble: false
            action_level: DEBUG
            type:  stream
            path:  "%kernel.logs_dir%/%kernel.environment%_request.log"
            channels: request
        main:
            type:  stream
            path:  "%kernel.logs_dir%/%kernel.environment%.log"
            level: debug
            channels: ["!doctrine", "!security", "!request"]

Here is my whole doctrine config in config.yml:

doctrine:
    dbal:
        driver:   %database_driver%
        host:     %database_host%
        port:     %database_port%
        dbname:   %database_name%
        user:     %database_user%
        password: %database_password%
        charset:  UTF8
    orm:
        auto_generate_proxy_classes: %kernel.debug%
        auto_mapping: true

I have the 3 files

../../../logs/prod.log
../../../logs/prod_request.log
../../../logs/prod_security.log

I can't manage to get prod_doctrine.log.

I tried all the channels in the same file prod.log. I had all channels alright, except doctrine...

What can prevent the logging of doctrine? Is there some incompatibility with my versions?

Alsciende
  • 26,583
  • 9
  • 51
  • 67
  • Can you please show what your `doctrine.dbal.logging` config value is? – Eternal1 Jul 21 '14 at 09:50
  • Sure. I edited my question. `doctrine.dbal.logging` is not configured. – Alsciende Jul 21 '14 at 09:59
  • Ok, I see where that's leading. `kernel.debug` is set to false in prod environment. Since `doctrine.dbal.logging` is equal to `kernel.debug` by default, it's set to false... – Alsciende Jul 21 '14 at 10:02
  • Thank you. Setting `doctrine.dbal.logging` to true works. Please add an anwser so I can award you the bounty. – Alsciende Jul 21 '14 at 10:05

1 Answers1

7

Set doctrine.dbal.logging to true to enable production doctrine logging.

Eternal1
  • 5,447
  • 3
  • 30
  • 45
  • See official documentation: https://symfony.com/doc/4.4/reference/configuration/doctrine.html#doctrine-dbal-configuration – numediaweb Oct 02 '20 at 09:04