Rails app logging duplicate requests

前端 未结 8 2179
感情败类
感情败类 2021-01-04 19:37

I have a Rails app that is generating duplicate requests for every request in development. The app is running Rails 2.3.5 with my primary development machine running Ubuntu

相关标签:
8条回答
  • 2021-01-04 19:48

    I resolved this problem by commenting the following line in app/config/environments/development.rb:

    config.middleware.use Rails::Rack::LogTailer
    

    I do not remember exactly the reason to use this setting

    0 讨论(0)
  • 2021-01-04 19:52

    When people come to this question from google it's important they disambiguate their problem between duplicate logs that look like this:

    A
    A
    B
    B
    C
    C
    

    From duplicate logs that look like this:

    A
    B
    C
    
    A
    B
    C
    

    The former is likely from duplicate LOGGING. The later is likely from duplicate REQUESTS. In the case it is the latter as shown by the Question Asker (OP), you should strongly consider @www's answer of hunting down a <img src="#"> or a similar self-referential url tag. I spent hours trying to figure out why my application was appearing to make two duplicate requests, and after reading @www's answer (or @aelor's on Double console output?), I found

    %link{href: "", rel: "shortcut icon"}/
    

    in my code! It was causing every page of my production app to be double rendering!!!! So bad for performance and so annoying!

    0 讨论(0)
  • 2021-01-04 19:52

    I solve this same problem here by cleaning all precompiled assets with: rake assets:clean

    I've tried to delete the app folder and then checkout him back from GitHub but didnt work.

    hope this help. thanks.

    0 讨论(0)
  • 2021-01-04 19:53

    Check your code see if there is something like this inside it:

    I have got the same problem just now becase of a tag

    <img src="#">
    

    this will cause rails to make duplicate requests!

    0 讨论(0)
  • 2021-01-04 20:03

    The "answer" to the problem was to move to a new directory and fetch the original code from Github. After getting everything configured and setup in the new directory the application works as it should with no duplicate requests. I still don't know why the code in the original directory borked out; I even diff'ed the directories and the only outliers were the log files.

    I'm answering my own question here for the sanity of others that might experience the same problem.

    0 讨论(0)
  • 2021-01-04 20:04

    This started happening to me on development after playing around with some custom middleware I wrote. Running rake assets:clean:all solved it.

    0 讨论(0)
提交回复
热议问题