I am trying to create pretty error pages for my application by following this cookbook article. Sometimes a bug slips in, which causes the application to return a single line: 503 Service Unavailable
. It would make my life a whole lot easier if only I could see the underlying error or exception thrown. Switching over to the development environment doesn't help either as the error templates are only used in production.
I figured out that I needed to add TwigBundle
to assetic's configuration to use javascript and css assets. Problems like this are really hard to debug in the production environment.
Setting the debug mode to true
in my front controller doesn't help, since production error templates get replaced by development templates.
EDIT
Thanks to Mike Purcell I managed to retrieve the errors provided. I got
Uncaught exception 'Symfony\Component\Routing\Exception\ResourceNotFoundException' in /[snip]/app/cache/prod/appprodUrlMatcher.php:669
Turns out the framework should be handling the exception, but in the case of a possible error inside the error Twig template, it just decides to throw a 503 error.
How do I turn on error reporting for the production environment in a Symfony2 application?
I'm tired of guessing what's wrong and clearing the cache. What is the best way to debug Twig's error templates in production?
error_log
. Unfortunately the log is empty. – kgildenerror_log
entry. us3.php.net/manual/en/errorfunc.configuration.php#ini.error-log . You can check your current setting by running this via cli:php -i | fgrep -i error_log
– Mike Purcellerror_reporting
anddisplay_errors
. Found the code suppressing errors and commented it out. Success! I'm getting aResourceNotFoundException
which in turn should trigger rendering the error template, but the exception is not caught. – kgilden