How I can create my own custom log file in magento2 ?

For example, I have some variable which wants to log in a custom file. I found a solution for only existing log file like system.log, debug.log but I want new custom log file to log my variable.


1 Answer 1


For logging OR creating log file, you should use class "Magento\Framework\Logger\Monolog".

For more see here : http://inchoo.net/magento-2/magento-2-logging/

Not the answer you're looking for? Browse other questions tagged or ask your own question.