title: What is the best way to debug production error templates?
body: <p>I am trying to create pretty error pages for my application by following this <a href="http://symfony.com/doc/current/cookbook/controller/error_pages.html" rel="nofollow">cookbook article</a>. Sometimes a bug slips in, which causes the application to return a single line: <code>503 Service Unavailable</code>. 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.</p>
  
  <p>I figured out that I needed to add <code>TwigBundle</code> to assetic's configuration to use javascript and css assets. Problems like this are really hard to debug in the production environment.</p>
  
  <p>Setting the debug mode to <code>true</code> in my front controller doesn't help, since production error templates get replaced by development templates.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Thanks to Mike Purcell I managed to retrieve the errors provided. I got</p>
  
  <blockquote>
    <p>Uncaught exception 'Symfony\Component\Routing\Exception\ResourceNotFoundException' in /[snip]/app/cache/prod/appprodUrlMatcher.php:669</p>
  </blockquote>
  
  <p>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.</p>
  
  <p><s>How do I turn on error reporting for the production environment in a Symfony2 application?</s></p>
  
  <p>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?</p>