I usually var_dump object->getData() in my module to see what's it it. Because of the injection dependencies , it looks like i cannot do that anymore. When i try it, nothing is printed out, which is likely because the amount of data connected to it is too large??? Can someone suggest an easy way to debug object in Magento 2? Thank you


Xdebug is the way to go. You can use Phpstorm in conjunction with Xdebug to pause execution of the code at designated break points and explore ALL data. I use it on Magento 2 every day.

In fact, I made a series of videos on how to install and configure

PhpStorm & Xdebug: Installation & Configuration

I hope this helps to get you going in the right direction!

  • @filne I also recommend to use the xDebug because it is the really best way to obtain all possible object data. – Siarhey Uchukhlebau Sep 10 '16 at 11:24
  • Have you tried xdebug with php7.0...it never breaks and page is permanently loading. – Stevie G Jan 10 '17 at 14:18
  • While I am not sure why that issue is happening for you, I know that for PHP 7.0 you have to make sure that you have the most recent version of xdebug. In fact, I am using Xdebug on Magento 2 with PHP 7.0 right this minute, no problems. – Shawn Abramson Jan 10 '17 at 14:21

You can use this method for log :

$om = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $om->get('Psr\Log\LoggerInterface');

Here "$priceValue" is the object which you want to print.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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