Introduction:
Debugging is one of the most powerful ways to find the root cause of an issue. To debug the issue on Magento, we have many methods, like enabling developer mode, enabling templates for debugging, using logs and other tools, etc. By the way, on Magento, you can’t use Zend_Log_Writer_Stream to create custom logs.
Hello Everyone! This is MO😉. This blog will explain how to install and use our custom module to generate custom logs on Magento 2.
Download our plugin Magento_Logger from Git Hub.
Setup Steps:
- Once you have the plugin, place the module under the app/code directory.
- Run the deployment commands. If you're a beginner at Magento, check out our blog on module creation.
- To verify the module installation, go to app/etc/config.php and look for the module name Mohith_Logger, which is set to 1.
How to use:
- Inject the file \Mohith\Logger\Logger\Logger to your constructor class, and you can use their object in any of the methods of the class to log the details, whichever you wish to.
- To verify, visit the var/log/ directory, where you will be able to find the mohith.log file.
Note:
It is advised to remove or delete the logs once debugging is done.
FAQ’s
Is this plugin free?
Yes, you can download it from Git Hub.
Does this plugin work with Magento 2.4?
Yes, it works with Magento 2.3.x and 2.4.x versions too.
Thank you for Reading. Are you fascinated to know more about Magento? What are you waiting for? Check out the other blogs in the Magento section and other Magento Plugins. Follow us on YouTube, Github, and Instagram to know more about us. Always happy to hear from you. The Code improvement and Module Enhancement are Appreciated. For any Magento 2 projects or Magento 2 freelancing, contact me at "mohithdeveloper@gmail.com".

0 Comments