Skip to content

How to create a custom Log file in Magento 2

How to create a log file in Magento 2. create a custom.log file using default magento2 logger(Monolog), so now I am going to explain step by step.

Step 1: Register Logger in Dependency Injection
create file di.xml by following the path app/code/Dev/Testing/etc/di.xml

Step 2: Create a Handler class on this Directory
app\code\Dev\Testing\Logger

Step 3: Create a Logger class on this Directory
app\code\Dev\Testing\Logger

Step 4 : log data in your log file custom.log

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Share via
Copy link
Powered by Social Snap