Contributed by Grégoire Pineau in #42244.
In Symfony applications, logging is available either via Symfony's built-in logger and or via the Monolog logger and its tight integration with Symfony. When using Monolog you can access to features such as excluding certain HTTP codes from logs and logging messages to different files. In Symfony 5.4 we've improved the logger with a new feature to make exceptions configurable per class. Using the new framework.exceptions option you can now define the log level and the HTTP status of the exceptions associated to a certain class:
1
2 3 4 5 6 7 8 9
config/packages/framework.yaml
framework: exceptions: Symfony\Component\HttpKernel\Exception\BadRequestHttpException: log_level: debug status_code: 422 App\Something\Exception\SomeException: log_level: alert status_code: 503
Although this example uses the YAML config format, this feature is also available when using XML or PHP as the config format.
Sponsor the Symfony project.
Connectez-vous pour ajouter un commentaire
Autres messages de ce groupe
SymfonyLive Paris 2025, conference in French language only, will take place from March 27 to 28! The schedule is currently being revealed as we go along. More details are available here.
Al
SymfonyLive Berlin 2025, conference held in English, will take place from April 1 to 4! The schedule is being revealed gradually. More details are available here.
As we are now unveiling th
This week, Symfony released maintenance versions 6.4.18, 7.1.11 and 7.2.3. In addition, Twig published a security advisory and we shared several updates about upcoming Symfony conferences. Lastly, Sym
We were absolutely thrilled to gather with the incredible Symfony community for the first time in Vienna, Austria, from December 5th to 6th, surrounded by the warm and festive atmosphere of the
SymfonyLive Paris 2025, conference in French language only, will take place from March 27 to 28! The schedule is currently being revealed as we go along. More details are available here.
💻
Symfony has been active on X, Mastodon, and Bluesky for some time, but until recently, not all platforms received equal attention. Since Twitter (now X) was our first social network, all blog posts we
SymfonyLive Berlin 2025, conference held in English, will take place from April 1 to 4! The schedule is being revealed gradually. More details are available here.
As we are now unveiling th