How do enable logging in Magento 2, i'm in development mode, i've checked file permissions on all the log files and they all have write access. Magento errors are also visible. Is there anything else i need to do?

i'm just trying to write "test" to the logs for now, i've instantiated the logger class through DI and i'm calling debug as follows:


I've checked the debug.log and the system.log and there's nothing in there?


1 Answer 1


Use below code for print in log file

$this->_logger->log(\Psr\Log\LogLevel::DEBUG, "test");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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