I am working on my first Symfony-based WebApp project. I configured Symfony not only to write log messages to different log files, but also to send critical error messages right away via email. It works great. However, I would like to add additional information to the default log messages to make it easier to find the actual source of the errors.
Example: A Twig file on one page loads localized text from a .yml file. The texts contain a placeholder %about_link%that must be replaced by the route / URL on the About page. I forgot this replacement, so the link did not point to the URL, but instead %about_link%. This results in NotFoundHttpExceptiona route cannot be found %about_link%...
No big deal. But finding the actual page / controller containing this error was a bit difficult. The default log message shows the following:
[2015-12-14 17:19:36] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /%25about_link%25"" at /long/path/to/symfony/.../RouterListener.php line 176 []
Thus, when trying to find a route to the %about_link%exception was selected at RouterListener.php. Well, that doesn't give me a hint on which page this bad link is located.
Of course, calling a bad route does not have to be placed on any page. The user could enter a bad link directly. Symfony will store / remember the last page to give any hint of a possible source. So, is it possible to include this information at all?
In addition, I would like to add information about the host that was reported. I am launching two instances of WebApp: www.my_web_app.xyand betatest.my_web_app.xy, and that would be a big help if the log message was displayed if it comes from wwwor from betatest.
, , , , Symfony ? - , . ?