Leo Jiang Leo Jiang - 1 year ago 115
PHP Question

How can I save a PHP backtrace to the error log?

I'm using this right now:


But I have to unserialize it every time. Is there a better way to store backtraces?

Answer Source

This should generate a readable string:

error_log(print_r(debug_backtrace(), TRUE));

Additionally, debug_print_backtrace() prints the back trace as string and its output can be captured with regular output buffer functions:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download