Is it possible in Ruby on Rails to log only the SQL commands generated and save it on a separate file?
I'm still in development mode and looking to save all the SQL commands on a seperate log.
I've checked the development.log files but they also save data like the
"Started GET "/assets/application.css" for 127.0.0.1 at 2014-02-17 16:41:47 +0800, etc.
I am looking to either create a separate log file only for SQL or remove these other lines leaving only the SQL commands.
Is this possible? Thank you.
如果您使用活动记录,则可以覆盖活动记录记录器:
ActiveRecord::Base.logger = Logger.new("#{Rails.root}/log/sql_log.log")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.