In my normal projects, I use xdebug with phpstorm and it's great; I have no problem with it. However, in Magento2, using xdebug on my localhost is not possible because when xdebug remote is enabled in php.ini, Magento2 takes 1-2mins to load a page. It's totally frustrating.
Disabling the xdebug extension in php.ini will immediately increase the page load to about 5-10secs. Still slow, but better than minutes.
I've now resorted to print_r and logger everywhere in my code. But this is incredibly painful! More so when Magento reports that the error is coming from some factory which then I have to go in and mess up the core with all my print statements!
I've tried on 2 different computers and they both have the same issue with xdebug. First one is a Windows7 x64 8GB ram on an i5 processor. Second machine is a Windows10 x64 16GB ram on an i7 processor.
What is wrong with debugging Magento2 with xdebug? Ideally, I'd like to use a debugger. How can I fix this? Otherwise, how else can I debug when developing on Magento2?