Ruby on rails 4 logging problem

When I look at the views represented by the ror map, everything is logged in to the console, but when the ajax call is made on my server using some user action executed on the page, I don’t get this part in the log, I don’t see the SQL executed in the console , and hard to debug problems.

What can I do to enable logging for ajax requests?

+5
source share
2 answers
  • Try to get to the AJAX endpoint directly from the browser, or better yet with curl .

    In any case, check to see if there is an answer especially the headers and compare with another endpoint that is correctly logged.

  • Use something like pry to confirm that you are actually pushing the code that you think you are pushing.

  • Check out spring . Easy to get into another process.

+2
source

I would add this as a comment, but I do not have enough reputations in your browser developer tools, go to the network tab and make sure that the request is even sent to the server. Most likely, it is not that everything else is registered correctly. Assuming you're in a development environment, you can also make sure your log level is in debug mode to show more descriptive information such as SQL. if you need to run the logger in a specific environment file (although it should be installed by default), try:

config.logger = Logger.new (STDOUT)

+1
source

Source: https://habr.com/ru/post/1237776/


All Articles