Created
August 3, 2010 01:08
-
-
Save huacnlee/505635 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 开启在 script/console 里面显示SQL查询日志 | |
# Ruby on Rails script/server 的时候,你会看到所有查询的调用日志,SQL语句,是否用缓存,还有执行时间等 | |
# 如何在 script/console 里面也实现这样的功能呢? | |
# 我们只需要修改 ~/.irbrc 文件并加入下面的代码就好了(.irbrc 如果没有可直接创建一个) | |
# jason@ubuntu:/home/huacnlee/wwwroot/pasite$ cd ~ | |
# jason@ubuntu:~$ sudo vim .irbrc | |
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER') | |
require 'logger' | |
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment