Search code examples
shopwareshopware6

Set LogLevel to DEBUG without setting APP_ENV to debug


I need to get verbose logging while sorting out issues in the migration. If I set the APP_ENV to debug like described in the Shopware 6 Tutorials, I will get memory issues all the time because the Symfony Framework will also enable debug mode and cause huge memory consumption. This is a known issue while running the Migration tool.

How can I set the Logger to a more verbose logging level without setting the whole stack into debug mode?


Solution

  • You could try and take the monolog config for dev and apply it to prod. Overwrite the config by creating {SHOPWARE_ROOT}/config/packages/prod/monolog.yaml with this content:

    # copied from src/Core/Framework/Resources/config/packages/dev/monolog.yaml
    monolog:
        handlers:
            main:
                type: stream
                path: "%kernel.logs_dir%/%kernel.environment%.log"
                level: debug
                channels: ["!event","!doctrine"]
            console:
                type:   console
                process_psr_3_messages: false
                channels: ["!event", "!doctrine", "!console"]
    

    However, this might not be enough for your needs, as some services might still use %kernel.debug% to determine when to log.