Bráulio Bhavamitra <[email protected]> wrote:
> Rails/nginx already log many request on production.log/access.log, but
> I can't know which of them timeouted.

Can't Rails log when a request starts and finishes?
(I haven't touched Rails in years)

Look for starts on PIDs without finishes.

Something along the lines of the following middlware (totally untested):

    class LogBeforeAfter
      def initialize(app)
        @app = app
      end

      def call(env)
        env["rack.logger"].info("#$$ start #{env['PATH_INFO']}")
        response = @app.call(env)
        env["rack.logger"].info("#$$   end #{env['PATH_INFO']}")
        response
      end
    end

    -------------- config.ru ---------------
    use LogBeforeAfter
    # other middlewares...
    run YourApp.new

See Rack::CommonLogger source for more examples/detail.

Reply via email to