Symfony2 Monolog configure to use raven handler (Sentry)
monolog, php, symfony
Solution
This is part of `config_prod.yml`:
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: grouped_main
sentry:
type: raven
dsn: 'http://user:pass@url/1'
level: notice
# Groups
grouped_main:
type: group
members: [sentry, streamed_main]
# Streams
streamed_main:
type: stream
path: %kernel.logs_dir%/%kernel.environment%.log
level: error
Enjoy! :)
Problem
I want to use sentry to evaluate possible errors, exceptions, etc. I tried to use the KunstmaanSentryBundle and it's great to catch all kind of errors like undefined functions and so on, but I want to define my own Monolog channel with it's own handler, but unfortunately I haven't found documentation about it. `config.yml` would be something like: ``` monolog: handlers: sentry: type: stream level: error //Log to database parameter (raven for sentry) ``` Does anybody knows the right configuration?