I would like to log the stacktrace of all exceptions thrown caught or uncaught.
Is there a way to do this without having to change every catch method in my application?
Thanks!
I would like to log the stacktrace of all exceptions thrown caught or uncaught.
Is there a way to do this without having to change every catch method in my application?
Thanks!
You can use the methods from the phps base Exception class. Use getMessage to get the message Oh no! and use getTraceAsString to get a formatted trace. refer : Log caught exception with stack trace
You could use https://github.com/php-test-helpers/php-test-helpers to override base exceptions __construct. Just add the 'logging' logic. There is a reason why this package is called test-helpers . I don't recommend using it on production.
Anyway...it is better to rewrite your app :)