Debugging

Debugging

The most powerful tool, and one Magento lacks out of the box. composer require --dev symfony/profiler-pack adds a toolbar at the bottom of every page in dev and a full request profile at /_profiler.

Profiler tab What to look for
Doctrine Number of queries, duplicates, N+1, EXPLAIN, mapping errors.
Events Which listeners ran, in what order and how long they took.
Security Current user, roles, firewall, voter decisions.
Performance Request timeline: where the time went.
Logs, Exception Logs of this request, the exception stack trace.
Validator Validation errors per field.
Messenger, Cache, HTTP Client Dispatched messages, cache hits and misses, outgoing requests.
  • dump($x) outputs to the profiler, dd($x) dumps and stops.
  • The profile of AJAX and API requests opens via the link in the X-Debug-Token-Link header.
  • In console commands, -vvv shows logs and the stack trace.
  • Xdebug works the same way as in Magento.