You can add Debug log in the Magento while you are working with the development feature for your project.
If you need to temporarily debug some of the code while working with the feature, you can directly add the given code snippet to your files to debug or print the log.
You can assume, want to print array data, $data = [‘test1’, ‘test2’];
$writer = new \Zend_Log_Writer_Stream(BP . '/var/log/custom.log'); $zendLogger = new \Zend_Log(); $zendLogger->addWriter($writer); $zendLogger->info(" Message Log " . print_r($data, true));
While your file runs the above code, In your system, check the root path starting with the var/log folder and a new custom.log file will be generated with your debug log.
This is the basic way you can add your log to the temporary var/log folder while working with the complex features of your project.