I have tried to print a log in Magento 2.2.2 but its not printing any log in debug.log file. I am using xampp server with php version 7.1.7

\Magento\Framework\App\ObjectManager::getInstance()->get('Psr\Log\LoggerInterface')->debug(print_r(['getCountries' => $countryCodes], true));

Let me know if i need to do any extra setting.


  • You have answer here link I think it's dublicate qiestion.
    – BartZalas
    Dec 26, 2017 at 17:41
  • @btek, I have already tried same link but its not working.
    – Meetanshi
    Dec 27, 2017 at 4:17

1 Answer 1


To enable log printing you need to set configuration from backend.

Goto Stores > Configuration > Advanced > Developer > Debug > Log to File to Yes.

  • 1
    I can't change, field is disabales. any idea? Sep 11, 2018 at 6:28
  • @ChiragPatel Please unchecked the checkbox besides the field and you will able to change its setting. Oct 15, 2018 at 13:37

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.