How to Log Bundle Product Data (Print Product complete information)In Default Product list.phtml file in magento 2.I am Getting

 foreach ($_productCollection as $_product):  

When I write

echo $_product->getProductUrl()
It is displaying correct product url.But When I tried to print the Entire Product Data by using
It is showing Blank Page I changed memory size but again showing blank page only (It is a bundle product) So atleast I want to Log that data in some test.log file for that I used
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/test.log');
$logger = new \Zend\Log\Logger();
$logger->info(print_r($_product->getData()), true);
but the test.log file is empty.Can anyone Help me on this.

1 Answer 1


You can try something like as well you can use this to pass data in to log.

        echo "<pre>";
  • thank you Krishna..It is printing product data but it is a bundle product na so i need bundled items also.Here Bundle Items are not showing.How to get Bundle items also like this way..? Commented Nov 3, 2016 at 10:20
  • 1
    You can refer this magento.stackexchange.com/questions/139920/… Commented Nov 3, 2016 at 10:22
  • definitely I will accept if it works :) Commented Nov 3, 2016 at 10:25

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.