Added logging for twig templates with an error

Fixes: #491, #530, #598