632

Rails SQL insert statements not showing up in console [duplicate]

Question:

This question already has an answer here:

<ul><li> <a href="/questions/2936000/how-to-show-sql-queries-run-in-the-rails-console" dir="ltr" rel="nofollow">How to show SQL queries run in the Rails console?</a> <span class="question-originals-answer-count"> 4 answers </span> </li> </ul>

My terminal used to display SQL table insert statements (as it should by default), and now it doesn't. Everything else - for example, GET requests, or local server startup info, or job completion notifications - appear as normal.

For the life of me, I can't figure out what the problem could be. I've been searching for a long time and can't figure out any reason this would happen. Do you have any ideas to point me in the right direction?

Answer1:

Put this in either in your .irbrc or .pryrc in your home directory

if defined?(Rails) && !Rails.env.nil? puts '... ActiveRecord and ActiveResource Logger set to STDOUT' logger = Logger.new(STDOUT) ActiveRecord::Base.logger = logger ActiveResource::Base.logger = logger end

You should start to see the sql statements executing in the rails console. Hope this helps

Recommend

  • Eclipse code fomatting
  • Sharing Redis settings across routes
  • Thread Synchronization with IntentService
  • Spring Integration debounce/deduplicate
  • Generating random numbers directly inside a .htaccess file
  • “A GKScore must specify a leaderboard.”
  • File extension of zlib zipped html page?
  • New Firebase failed: First argument must be a valid firebase URL and the path can't contain “.”
  • JSON encode and decode on PHP
  • Building Qt project for C++11 standard
  • MeeGo Handset Emulator not starting on Windows 7
  • How do I get the list of bad records that didn't load in Bigquery?
  • How Get arguments value using inline assembly in C without Glibc?
  • git add error : “fatal : malloc, out of memory”
  • How to make JSON.NET deserialize to Microsoft Date Time?
  • ADO and msqli connections very slow
  • How to get Eclipse Oxygen to run on Java 9
  • PHP buffered output depending on server setting?
  • Content-Length header not returned from Pylons response
  • Play WS (2.2.1): post/put large request
  • Could not find rake using whenever rails
  • Extracting HTML between tags
  • Q promise. Difference between .when and .then
  • How to rebase a series of branches?
  • How to access EntityManager inside Entity class in EJB3
  • javaw.exe and eclipse startup problems
  • Resize panoramic image to fixed size
  • Volusion's generic SQL folder, functionality
  • Join two tables and save into third-sql
  • vba code to select only visible cells in specific column except heading
  • How to model a transition system with SPIN
  • what is the difference between the asp.net mvc application and asp.net web application
  • How to make Safari send if-modified-since header?
  • ORA-29908: missing primary invocation for ancillary operator
  • Web-crawler for facebook in python
  • How do you join a server to an Active Directory (domain)?
  • coudnt use logback because of log4j
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • costura.fody for a dll that references another dll
  • Converting MP3 duration time