Last active
July 27, 2023 09:01
-
-
Save jlnarvaez/90fee1c1bebe09d67ae4695658f3aedb to your computer and use it in GitHub Desktop.
Magento 2 Custom Log (for Development purposes)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This snippet is useful to debug in production environments. | |
* DON'T USE THIS CODE TO LOG IN YOUR MODULES. | |
* To create a custom log check Magento official documentation | |
* (https://devdocs.magento.com/guides/v2.4/config-guide/log/custom-logger-handler.html) | |
*/ | |
// Custom Log for Magento v2.3 or < | |
(new \Zend\Log\Logger())->addWriter((new \Zend\Log\Writer\Stream(BP . '/var/log/pruebas.log')))->info('Simple Text Log'); | |
// Custom Log for Magento 2.4 or > | |
(new \Zend_Log())->addWriter((new \Zend_Log_Writer_Stream(BP . '/var/log/pruebas.log')))->info('Simple Text Log'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment