Magento 2 – How to add custom logs in Magento 2 for debugging? / Learn Magento 2 Adobe Commerce / By Saphal Use below code anywhere is Magento (Only for debugging) PHP$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/your_log_file_name.log'); $logger = new \Zend\Log\Logger(); $logger->addWriter($writer); $logger->info('=== Your Comment Here ==='); $logger->info(print_r($value,1)); //true param is important to print the array in logNOTE: The above code is only for debugging purpose only, you should remove once you done debugging.