无法为产品环境向独白添加新频道

Cannot add a new channel to monolog for prod environment

我想在我的 monolog 配置中添加一个新块,以便在单独的日志文件中包含特定包的日志。假设频道名为 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

在开发模式下,一切都很好,购买日志写在 purchase_dev.log 中。但是,虽然prod模式的日志配置和dev模式一样,我还是报这个错

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

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