You have to watch out for the fact that monolog handlers are redefined in config_prod.yml and config_dev.yml, so if you define them in config.yml they will just be overwritten by the prod or dev config. I'm not sure where you did it but if you have the redis and monolog configs together it is a probable cause that you just configured monolog in the wrong file.
Logging messages to Redis with monolog is not working
Question
I want to log messages to a local Redis server with Monolog in a Symfony 2 project. I'm using the SncRedisBundle for this purpose.
This should be straight forward following the documentation, but it seems that no messages are stored in Redis. If I use the the default Redis client configured and write something to the Redis server this works perfectly.
My configuration is the following:
snc_redis:
clients:
default:
type: predis
alias: default
dsn: redis://localhost
monolog:
type: predis
alias: monolog
dsn: redis://localhost/1
logging: false
options:
connection_persistent: true
monolog:
client: monolog
key: monolog
monolog:
handlers:
custom:
type: service
id: snc_redis.monolog.handler
level: debug
Does anybody know how I can fix this issue?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow