Comments (10)
Good suggestion, will look into this.
from php-rest-api.
You could extend the exception listener to implement a logger or create a separate listener with a higher priority where you can log them.
from php-rest-api.
Thank you for a quick answer, @slootjes :) The case is that right now, for all API endpoints which use the php-rest-api, no errors are logged at all - even those which Symfony logs automatically by default as Uncaught PHP Exceptions.
Is the error logging suppressed on purpose? Is the suggested strategy to log errors always before the RestApiEventSubscriber handles the response?
from php-rest-api.
Error logging isn't suppressed on purpose but it's really important that generating a correct output is generated before any other handler will usually do that. If I would want to log errors myself the strategy would indeed be to have another subscriber which is triggered before this one is.
from php-rest-api.
I understand why it needs to happen as an early event, but it also means no other listeners will be triggered.
Would it make sense to add a default Uncaught exception logger as Symfony does it by default? Or is this completely out of scope from your point of view and there should be a custom ErrorHandler registered?
from php-rest-api.
I don't think this is the responsibility of the bundle, you should handle that sort of things in your own handlers/subscribers.
from php-rest-api.
OK, I understand.
Maybe it would be a good idea to mention it in the documentation, because in case somebody just enables the bundle for all his routes, no errors will be ever logged the way Symfony does that by default and that is a bit unclear.
from php-rest-api.
Awesome stuff, thanks a lot!
from php-rest-api.
Closing this due to it being as old as dinosaurs.
from php-rest-api.
Aww
from php-rest-api.
Related Issues (2)
- plans for PHP 8? HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-rest-api.