Search code examples
monologsymfony-3.2rollbar

Set up monolog to use rollbar with symfony3?


config.yml

handlers:
        rollbar:
            type: stream
            token: '%rollbar.token%'
            level: warning
            bubble: true
            config:
                environment: '%rollbar.environment%'
        main:
            type:   stream
            path:   "%kernel.logs_dir%/%kernel.environment%.log"
            level:  debug

There is no activity on rollbar

$this->get('logger')->warning('testing rollbar');

I have tested their own code (using rollbar/rollbar) which works OK (from below instructions)

https://rollbar.com/docs/notifier/rollbar-php/#installation


Solution

  • I've got Rollbar on my own Symfony app, but it looks like you have the type set to just send it to the standard log files.

    rollbar:
        token: "%rollbar_serverside_token%"
        type:  "rollbar"   ## This enables the Rollbar handler
        config:
            environment: "%kernel.environment%"
            handler: blocking
        level: debug
    

    Since I've grouped the Rollbar handler under a 'fingers_crossed' main/default handler, it only throws items to the outside service if an exception occurs.