Symfony 3.4 – How to debug_backtrace?

  debug-backtrace, php, symfony, symfony-3.4

I am using Symfony 3.4, and I am trying to

file_put_contents('/var/www/html/var/logs/deleted.log', print_r(debug_backtrace(), true), FILE_APPEND);

However, I am getting

Uncaught PHP Exception SymfonyComponentDebugExceptionOutOfMemoryException: "Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 98570240 bytes)

It appears the debug_backtrace might have quite a bit of un-necessary information, Any ideas how I can accomplish this the Symfony way?

Source: Symfony Questions

LEAVE A COMMENT