Giter VIP home page Giter VIP logo

Comments (10)

mediamonks-robert avatar mediamonks-robert commented on July 29, 2024 1

Good suggestion, will look into this.

from php-rest-api.

slootjes avatar slootjes commented on July 29, 2024

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.

krioo avatar krioo commented on July 29, 2024

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.

slootjes avatar slootjes commented on July 29, 2024

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.

krioo avatar krioo commented on July 29, 2024

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.

mediamonks-robert avatar mediamonks-robert commented on July 29, 2024

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.

krioo avatar krioo commented on July 29, 2024

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.

krioo avatar krioo commented on July 29, 2024

Awesome stuff, thanks a lot!

from php-rest-api.

Edwin-Luijten avatar Edwin-Luijten commented on July 29, 2024

Closing this due to it being as old as dinosaurs.

from php-rest-api.

krioo avatar krioo commented on July 29, 2024

Aww 🥲

from php-rest-api.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.