This question already has an answer here:

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.

marked as duplicate by Raphael at Digital Pianism, Community May 6 '16 at 11:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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.