浏览文章
文章信息
Magento2 简单记录自定义日志方法logger
14493
构造函数中写入以下代码
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/templog.log'); $logger = new \Zend\Log\Logger(); $logger->addWriter($writer); $logger->info("Info". $product->getSku() . "----- Id ". $product->getId() ); $logger->info("preorder qty ". $product->getPreorderQty());