“Mage Log Magento 2” Código de respuesta

Magento2 Zend Log

<?php
  $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/MYLOGFILE.log');
  $logger = new \Zend\Log\Logger();
  $logger->addWriter($writer);
  $logger->info('Your text message');
?>
Excited Elk

Mage Log Magento 2

<?php /* for Magento 2.4 */
  $writer = new \Zend_Log_Writer_Stream(BP . '/var/log/custom.log');
  $logger = new \Zend_Log();
  $logger->addWriter($writer);
  $logger->info('Text Log'); //Text Log
  $logger->info('Array Log'.print_r($myArrayVar, true)); // Array Log
?>
<?php
  $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/logfile.log');
  $logger = new \Zend\Log\Logger();
  $logger->addWriter($writer);
  $logger->info('Simple Text Log'); // Simple Text Log
  $logger->info('Array Log'.print_r($myArrayVar, true)); // Array Log
?>
  
Itchy Ibex

Mage Log Magento 2

<?php /* for Magento 2.4 */
  $writer = new \Zend_Log_Writer_Stream(BP . '/var/log/custom.log');
  $logger = new \Zend_Log();
  $logger->addWriter($writer);
  $logger->info('Text Log'); //Text Log
  $logger->info('Array Log'.print_r($myArrayVar, true)); // Array Log
?>
Itchy Ibex

Log Magento 2.4.3

$writer = new \Zend_Log_Writer_Stream(BP . '/var/log/custom.log');
$logger = new \Zend_Log();
$logger->addWriter($writer);
$logger->info('text message');
Wandering Willet

Logger Magento2

$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/test.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info('Your text message');
Defeated Dog

Log Magento 1

Mage::log('message',null,'logfile.log',true);
Mage::log(print_r($arr, 1), null, 'logfile.log',true);
Colorful Corncrake

Respuestas similares a “Mage Log Magento 2”

Preguntas similares a “Mage Log Magento 2”

Más respuestas relacionadas con “Mage Log Magento 2” en PHP

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código