Silencing postgres log spam in rails 3 logs

2019-04-19 02:51发布

On every request my development.log contains a lot of entries like so:

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

These are completely drowning out the log messages I actually care about. Is there a good way to silence these extra messages?

1条回答
唯我独甜
2楼-- · 2019-04-19 03:37

Add this to your Gemfile, do a bundle install, and restart your server.

gem "silent-postgres"
查看更多
登录 后发表回答