sailthru / sailthru-magento2-extension

Sailthru extension for Magento 2
2 stars 12 forks source link

\Zend\Log deprecated with M2.4.3 #82

Closed M-Leggat closed 1 year ago

M-Leggat commented 3 years ago

From trying to upgrade from 2.4.1 > 2.4.3 there seems to be an issue with the compilation

php ./bin/magento setup:di:compile --ansi --no-interaction '-vvv'

From checking various logs, it seems to be with the Zend\Log\Logger class -

report.CRITICAL: Class \Zend\Log does not exist

I'm guessing this is a change from the Zend framework being slowly deprecated for laminas project?

File in question is -

vendor/sailthru/sailthru-magento2-extension/Logger.php

<?php

namespace Sailthru\MageSail;

use Magento\Store\Model\StoreManager;
use Zend\Log\Logger as ZendLogger;
use Zend\Log\Writer\Stream;

class Logger extends ZendLogger

You should be able to change it to use MonoLogger. I did take a very quick attempt try at this, but ran into some errors -

Type Error occurred when creating object: Sailthru\MageSail\Logger, Too few arguments to function Monolog\Logger::__construct(), 0 passed in /app/vendor/sailthru/sailthru-magento2-extension/Logger.php on line 18 and at least 1 expected

MonoLogger can be found at vendor/monolog/monolog/src/Monolog/Logger.php

For now, I've been able to just get rid of the construct method to allow the upgrade to work, so essentially getting rid of logging for the extension. If I circle back to this before after testing other parts of the upgrade I may attempt to rewrite it again, depending on time.

giraclion commented 1 year ago

Closing in favor of https://github.com/sailthru/sailthru-magento2-extension/pull/84