justbetter / magento2-sentry

Magento 2 module to log to Sentry
MIT License
165 stars 70 forks source link

not compatible with magento 2.4.4 #105

Closed PascalBrouwers closed 2 years ago

PascalBrouwers commented 2 years ago

not compatible with magento 2.4.4

PHP Fatal error:  Declaration of JustBetter\Sentry\Plugin\MonologPlugin::addRecord($level, $message, array $context = Array) must be compatible with Monolog\Logger::addRecord(int $level, string $message, array $context = Array, ?Monolog\DateTimeImmutable $datetime = NULL): bool in /vendor/justbetter/magento2-sentry/Plugin/MonologPlugin.php on line 54
indykoning commented 2 years ago

To make this compatible with 2.4.4 you have to update to version 3.1.0+ 🙂 https://github.com/justbetter/magento2-sentry/commit/8326975e7b5f8d4a6203b8e994d93a28331f0fe3

peterjaap commented 2 years ago

@indykoning are you sure?

That commit only adds $datetime as an argument to the parent::addRecord but in 2.4.4 the complete addRecord method has been removed; https://github.com/magento/magento2/blob/2.4.4/lib/internal/Magento/Framework/Logger/Monolog.php

In 2.4.3 it was still there; https://github.com/magento/magento2/blob/2.4.3/lib/internal/Magento/Framework/Logger/Monolog.php#L34

peterjaap commented 2 years ago

Right, i see now. Magento previously had that addRecord method overridden in their own lib. That wasn't needed anymore because of reasons (?) and now it gave an error because of datetime missing. So the easy fix was to remove the whole override, dus making parent::addRecord call to the original addRecord method in de Monolog package; https://github.com/Seldaek/monolog/blob/main/src/Monolog/Logger.php#L314

emreakay commented 1 year ago

any solution?