Thierry Lam
Thierry Lam

Reputation: 46264

Is there a way to configure Rails 3 to log SQL queries in its own log file?

In my dev environment, all logs are saved to logs/development.log. The log file contains SQL queries performed in each web page as well as other noise. Is there a way to configure Rails 3 to only log those queries in a separate log file? I'm currently using 3.2.11

Upvotes: 0

Views: 120

Answers (1)

Marc Baumbach
Marc Baumbach

Reputation: 10473

In your config/environments/development.rb file you can do something like this:

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

Upvotes: 5

Related Questions