在每个请求中,我的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
这些完全淹没了我真正关心的日志消息。是否有一种很好的方法来消除这些额外的消息?
答案 0 :(得分:15)
将其添加到您的Gemfile中,执行bundle install
,然后重新启动服务器。
gem "silent-postgres"