As a few of the KunstmaanSentryBundle users were asking for support for multiple environments, we decided it would be a good idea to refactor the bundle so this would become possible using the standard Symfony2 workflow. Because this refactoring has some backwards compatibility issues, we'd like to clearly show what you have to change to keep getting Sentry messages for your projects.

What changed?

In the initial version of the bundle we hardcoded some things, so Sentry logging would only be triggered on the prod environment. This worked well for us, but being able to enable or disable the Sentry bundle was a nice addition, and one we could benefit from as well when testing our sites locally. So now you can enable or disable them per environment, by changing the environment config file.

The B/C breaking change is that since this change, Sentry logging is disabled on all environments by default, and you have to explicitly enable it if you want Sentry logging to work as before.

In composer.json nothing has changed, so you still use :

  "require": {
    "kunstmaan/sentry-bundle": "dev-master"

NOTE: You can also use one of our stable branches (~2.2, ~2.3) instead of dev-master.

The first real change can be found in AppKernel.php, where you now should simply use the following snippet :

    public function registerBundles()
        $bundles[] = new Kunstmaan\SentryBundle\KunstmaanSentryBundle();
        return $bundles;

NOTE: The hardcoded environment check (for prod) has been removed, since the configuration setting now takes care of multiple environments.

In the configuration file of the environment where you want Sentry logging to be enabled you should add the following snippet :

    enabled: true
    dsn: "http://nnn:nnn@12345.12345.12345.12345/1"

If you are using the KunstmaanBundleStandardEdition you can set the dsn parameter to "%sentry.dsn%" and set the value in parameters.yml.dist.

So, in fact, to prevent the backwards compatibilty break, the only thing you should have to do is modify your AppKernel.php to remove the hardcoded environment check and add the snippet mentioned above to config_prod.yml ...

Thanks for your support!

We'd like to thank @toretto460 for his PR which set things in motion!