symfony / monolog-bundle

Symfony Monolog Bundle
symfony.com
MIT License
2.89k stars 230 forks source link

Updating from symfony 4 to 5 breaks with null handler #335

Closed gmponos closed 3 years ago

gmponos commented 4 years ago

I have upgraded my application from 4.4.1 to 5.0.1

inside my packages/test/monolog.yaml I have:

monolog:
    handlers:
        main:
            type: 'null'
            level: debug

When I run my tests I get Error : Call to undefined method Monolog\Handler\NullHandler::pushProcessor()

is this a bug or there is a workaround (besides setting test/debug handler)?

acasademont commented 4 years ago

I downgraded to monolog 1.X in the meantime, that should fix it.

By default, if you only have monolog-bridge in your composer.json, it will pick up the highest monolog version available (2.0.5). Explicitly requiring monolog/monolog:^1.25 should do it

tzunghaor commented 4 years ago

Symfony tried to push psr formatter processor to my null handler, but explicitly disabling it solved my problem:

monolog:
    handlers:
        main:
            type: 'null'
            process_psr_3_messages: false
Seldaek commented 4 years ago

The bundle should check whether ProcessableHandlerInterface is implemented (in Monolog 2) before calling pushProcessor.

jderusse commented 3 years ago

Fixed by #390