How to use Zend log Magento 2
To use Zend log use below code in any PHP file.
$yourmessageString = 'Hey from magento zend log';
$yourmessageArray = ['Hey from magento zend log Array '];
$writer = new \Zend\Log\Writer\Stream(BP . ‘/var/log/custom.log’);
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info($yourmessageString);
$logger->info(print_r($yourmessageArray,true)); //for array and objects
Comments
Post a Comment