Coder Social home page Coder Social logo

Comments (12)

josevalim avatar josevalim commented on May 17, 2024

When "Started POST" is logged, we still haven't passed through the method override middleware. I think the sanest fix is to include _method in the Parameters. That is handled here:

https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/log_subscriber.rb#L5

What do you think?

from rails.

dlee avatar dlee commented on May 17, 2024

Sounds good to me. I'll cook up a patch.

from rails.

dhh avatar dhh commented on May 17, 2024

We need to fix the "Started POST" part. Whatever is outputting that needs to look at _method. This used to work, so let's not go backwards.

from rails.

dlee avatar dlee commented on May 17, 2024

Alright, so this is a regression.
I think we should indicate somewhere in the logs both the original method and the overridden method.

josevalim's suggestion does this the easy way by showing the original method in the "Started ..." part and the overridden method in the params.

If you think that that's backwards, we can do something like "Started PUT (overrides POST)". What do you think?

from rails.

dhh avatar dhh commented on May 17, 2024

When will the "(overrides POST)" be a valuable piece of information? By the time Rails sees the request, Rails won't be able to tell whether it's a real PUT or an artificial PUT.

from rails.

dlee avatar dlee commented on May 17, 2024

I'd argue that showing the overrides would be useful in various debugging and analytic situations. Also, it could be useful in distinguishing whether or not the request was made by a browser. Rails certainly has the internal ability to differentiate between real and artificial put requests, and applications built on Rails should have the ability as well if they can access the rack env.

from rails.

dhh avatar dhh commented on May 17, 2024

I don't think it's a valuable enough piece of information to log with every request in the log. If you need it, you can always get at it directly via code. Or if you need it temporarily for debugging, you can do logger.info and output it yourself.

But let's definitely fix the core issue as described at the top of this ticket.

from rails.

dlee avatar dlee commented on May 17, 2024

Sounds like a plan.

from rails.

josevalim avatar josevalim commented on May 17, 2024

@dlee so it is just a matter of removing the started part from here:

https://github.com/rails/rails/blob/master/railties/lib/rails/rack/logger.rb#L24

To here:

https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/log_subscriber.rb#L7

The parameters available in the latter is defined here:

https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/instrumentation.rb#L18

from rails.

dlee avatar dlee commented on May 17, 2024

I actually went with a different approach since I assumed there was a reason the "Started ..." log was separated into railties/lib/rails/rack/logger.rb in the first place. Expect a pull request soon...

from rails.

josevalim avatar josevalim commented on May 17, 2024

Ok, but if the another approach is including a new middleware, I would say it is a no-go. :) Our middleware stack is already too long, which leads to a long call stack that Ruby 1.8.x doesn't like at all. Maybe we could log at the router level? Thanks for your time in this.

from rails.

josevalim avatar josevalim commented on May 17, 2024

Closing this one in favor of #430.

from rails.

Related Issues (20)

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.