What is the best way to debug production error patterns?

I am trying to create quite error pages for my application by following this article in a cookbook article . Sometimes an error occurs that causes the application to return a single line: 503 Service Unavailable . It would make my life a lot easier if I could see a major mistake or exception. The transition to a development environment does not help, since error patterns are used only in the production process.

I realized that I need to add TwigBundle in the asset configuration to use javascript and css assets. Such problems are really difficult to debug in a production environment.

Setting the debug mode to true in my front controller does not help, as production error patterns are replaced by development patterns.

EDIT

Thanks to Mike Purcell, I was able to get the errors provided. I got

Disable the exception "Symfony \ Component \ Routing \ Exception \ ResourceNotFoundException" in /β–Ίsnip†/app/cache/prod/appprodUrlMatcher.php:669

It turns out that the structure should handle the exception, but in case of a possible error inside the Twig error template, it just decides to throw the 503 error.

How do I enable error reporting for the desktop in a Symfony2 application?

I'm tired of guessing what is wrong and clears the cache. What is the best way to debug Twig error patterns during production?

+4
source share
2 answers

The best way to see what errors occur during the production process is to configure Monolog to send error messages to you too, or alternatively to a file.

Take a look at the Symfony2 Cookbook at http://symfony.com/doc/master/cookbook/logging/monolog_email.html

To make error pages look better, check out this cookbook article on how to do this http://symfony.com/doc/master/cookbook/controller/error_pages.html

+3
source

There are open source tools specifically designed for error reporting, such as Sentry , which has its own Symfony client .

disclaimer: I work for Sentry

0
source

All Articles