在rails 3日志中消除postgres日志垃圾邮件

时间:2011-02-01 04:11:50

标签: postgresql ruby-on-rails-3 logging

在每个请求中,我的development.log都包含很多条目:

SQL (0.5ms)   SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"table1"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum

SQL (0.5ms)   SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"table2"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum

这些完全淹没了我真正关心的日志消息。是否有一种很好的方法来消除这些额外的消息?

1 个答案:

答案 0 :(得分:15)

将其添加到您的Gemfile中,执行bundle install,然后重新启动服务器。

gem "silent-postgres"