Search code examples
phpnewrelicslim

What's the solid way to process and send the errors to NewRelic using Slim PHP Framework?


I'm using Slim Framework in the project. It was quite easy to setup the NewRelic transactions in Slim Framework using its hooks.

But what would be the best way to process any "common" errors? I am not talking about the custom ones. If something goes wrong or there would be any syntax errors in the project, how could I catch that and send to NewRelic?

I thought it might be setup on the PHP layer itself, it's not in the framework layer. But I don't see any errors in the NewRelic now, when there is a syntax errors in the project.

p.s. Now I have default newrelic loglevel - info (both for newrelic and deamon)

Thanks for any comment and explanation.


Solution

  • You might be able to add the PHP agents newrelic_notice_error() call with a custom error handler in the slim framework;

    http://docs.slimframework.com/#Error-Handler

    https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-api#api-notice-error