Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silencing postgres log spam in rails 3 logs

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?

like image 904
jonnii Avatar asked Feb 01 '11 04:02

jonnii


1 Answers

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

gem "silent-postgres"
like image 174
Dylan Markow Avatar answered Nov 03 '22 18:11

Dylan Markow