Question

I'm trying install NelmioSolariumBundle with my Symfony 2 application by following the read me, however after registering the bundle within the AppKernal.php I receive` the following error:

ErrorException: Catchable Fatal Error: Argument 1 passed to Nelmio\SolariumBundle\Logger::setLogger() must be an instance of Psr\Log\LoggerInterface, instance of Symfony\Bridge\Monolog\Logger given, called in /var/www/vhosts/symfony.example.com/app/cache/dev/appDevDebugProjectContainer.php on line 2096 and defined in /var/www/vhosts/symfony.example.com/vendor/nelmio/solarium-bundle/Nelmio/SolariumBundle/Logger.php line 44

After a bit of digging I found this article that states:

Monolog recently implemented PSR-3. It’s therefore known to implement the Psr\Log\LoggerInterface and its associated guidelines found in the PSR-3 document.

So now I'm trying to update my version of MonoLog and receive the following error within composer and am unsure where to go from here:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for symfony/monolog-bundle 2.2.* -> satisfiable by symfony/monolog-bundle v2.2.0.
- Conclusion: remove symfony/symfony v2.1.9
- symfony/monolog-bundle v2.2.0 requires symfony/monolog-bridge >=2.2-beta2,<3.0 -> satisfiable by symfony/symfony v2.2.0, symfony/symfony v2.2.1, symfony/monolog-bridge v2.2.0, symfony/monolog-bridge v2.2.1.
- Can only install one of: symfony/symfony v2.2.0, symfony/symfony v2.1.9.
- Can only install one of: symfony/symfony v2.2.1, symfony/symfony v2.1.9.
- don't install symfony/monolog-bridge v2.2.0|don't install symfony/symfony v2.1.9
- don't install symfony/monolog-bridge v2.2.1|don't install symfony/symfony v2.1.9
- Installation request for symfony/symfony == 2.1.9.0 -> satisfiable by symfony/symfony v2.1.9.

Do I need to completely update my Symfony 2 version in order to get it working?

Was it helpful?

Solution

Unfortunately due to the new interface etc it was not possible to keep things working with both cases. So Symfony 2.2+ and MonologBundle 2.2+ are required to use Monolog 1.4+.

That said, it seems to be a bug in the bundle that it requires the PSR LoggerInterface, because the old interface of Symfony is also compatible. I just pushed a v2.0.1 of the bundle, if you'd like to update and see if that works (you can rollback the changes to the requirements of monolog).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top