I have created different channels for my monolog, while working with my app (dev and test environment) everything is fine, creates and writes into all logs but when execute my tests (unit test) I am getting the following error: "The service definition "monolog.logger.event" does not exist" I've dump my "ContainerBuilder $container" in "vendor/symfony/monolog-bundle/DependencyInjection/Compiler/LoggerChannelPass.php" and for some reason the monolog.logger.event does not exists, all the rest of my channels do exists: doctrine, request, security, etc... I am pasting my monolog config corresponding to the channels:
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ['!event', '!snc_redis', '!doctrine', '!request', '!security']
event:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%_event.log"
level: debug
channels: ['event']
snc_redis:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%_redis.log"
level: debug
channels: ['snc_redis']
doctrine:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%_doctrine.log"
level: debug
channels: ['doctrine']
request:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%_request.log"
level: debug
channels: ['request']
security:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%_security.log"
level: debug
channels: ['security']
Any clue how can I fix this
It is happens because web/app_test.php and console have different debug flag, for example:
#web/app_test.php
$kernel = new AppKernel('test', false);
#bin(app)/console
$kernel = new AppKernel('test', true);
In this situation web application cannot find the right cache container file.