FOSRestBundle icon indicating copy to clipboard operation
FOSRestBundle copied to clipboard

Symfony 4.1 does not log exception error

Open anvodev opened this issue 7 years ago • 2 comments

Hi there, I am using symfony 4.1 with FOSTRestBundle 2.3.1 The error is not logged whenever exception is called. After digging to the code, I saw that while listening to the KernelEvents::EXCEPTION, the http-kernel already decoupled the log outside of onKernelException which called onLogKernelException, while the FOSTRestBundle does not call the onLogKernelException part.

Reference links: https://github.com/symfony/http-kernel/blob/master/EventListener/ExceptionListener.php https://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/EventListener/ExceptionListener.php

Please update the FOSTRestBundle so that it will be compatible with this new Symfony 4.1 change Thanks

anvodev avatar Jun 19 '18 07:06 anvodev

Would you like to create a PR?

xabbuh avatar Jun 21 '18 09:06 xabbuh

The Symfony\Component\HttpKernel\EventListener\ExceptionListener::logKernelException() has a priority of 0 while the FOS\RestBundle\EventListener\ExceptionListener::onKernelException() has a priority of -100 and Symfony\Component\HttpKernel\EventListener\ExceptionListener::onKernelException() has a priority of -128. So the logKernelException should be always called.

What am I missing ?

magnetik avatar Jul 25 '18 09:07 magnetik