1
votes

I wanted to add a new block in my monolog config in order to have logs of a specific bundle in a separate log file. Say that the channel is called purchase

config_dev.php / config_prod.php

    purchase:
        type:  rotating_file
        max_files: 10
        path:  %kernel.logs_dir%/purchase_%kernel.environment%.log
        level: debug
        channels: purchase

In dev mode, every thing works great and the puchase logs are written in purchase_dev.log. However, although the log configuration of prod mode is the same as dev mode, I'm getting this error

Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\InvalidArgumentException' with message 'The service definition "monolog.logger.purchase" does not exist.' in /home/users/me/projects/ecoback/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:798

1
can you share your config*.yml files?Mehmet Soylu

1 Answers

3
votes
monolog:
    channels: ["purchase"]
    handlers:
        purchase:
            type:  rotating_file
            max_files: 10
            path:  %kernel.logs_dir%/purchase_%kernel.environment%.log
            level: debug
            channels: ["purchase"]