Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails3 SQL logging output in a separate file

I'd like to have all my ActiveRecord SQL logging to have redirected in a different file. It's kinda messy to have it on the console or in the log/development.log.

How to do that? I'd love to have it in a log/development_sql.log file.

Thanks

like image 485
lzap Avatar asked May 12 '11 10:05

lzap


1 Answers

ActiveRecord::Base.logger = Logger.new('log/development_sql.log')
like image 92
J-_-L Avatar answered Sep 19 '22 06:09

J-_-L