Symfony2 Monolog will configure the use of a raven handler (Sentry)

I want to use the sentinel to evaluate possible errors, exceptions, etc.

I tried using KunstmaanSentryBundle, and it is great to catch all kinds of errors, such as undefined functions, etc., but I want to define my own Monologue channel with its own handler, but unfortunately I did not find the documentation about It.

config.yml will look something like this:

monolog:
  handlers:
    sentry:
        type:  stream
        level: error
        //Log to database parameter (raven for sentry)

Does anyone know the correct configuration?

+4
source share
2 answers

This is the part 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! :)

+12
source

It needs to be added as a comment on the accepted answer, but not enough rep, so:

\Symfony\Bundle\MonologBundle\DependencyInjection\Configuration:

" ( ):

  • :
    • dsn:
    • client_id: Raven ()
    • [level]: int, DEBUG
    • [bubble]: bool, - true

"

:

monolog:
    handlers:
        sentry:
            type: raven
            dsn: '%sentry_api_key%'
            client_id: 'your.raven.client.custom.service.id'
            level: notice
            bubble: false
+5

All Articles