title: Log every SQL query to database in Rails
body: <p>I want to save to a log file some SQL query rails performs, (namely the CREATE, UPDATE and DELETE ones)
  therefore I need to intercept all queries and then filter them maybe with some regexp and log them as needed.</p>
  
  <p>Where would I put such a thing in the rails code?</p>