lzap
lzap

Reputation: 17174

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

Upvotes: 7

Views: 1158

Answers (2)

Vasiliy Ermolovich
Vasiliy Ermolovich

Reputation: 24617

You can set it in config/application.rb:

config.active_record.logger = Logger.new("log/development_sql.log")

Upvotes: 7

J-_-L
J-_-L

Reputation: 9177

ActiveRecord::Base.logger = Logger.new('log/development_sql.log')

Upvotes: 10

Related Questions