Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Silence SQLite3 logger in Sinatra with Active Record?

The guard output window fills up with

D, [2012-11-19T18:36:30.391459 #53057] DEBUG -- :    (0.1ms)  begin transaction
D, [2012-11-19T18:36:30.392668 #53057] DEBUG -- :   SQL (0.4ms)  INSERT INTO "foo" ("created_at", "id", "foo", "foo", "updated_at", "value") VALUES (?, ?, ?, ?, ?, ?)  [["created_at", 2012-11-19 18:36:30 -0800], ["id", 4], ["bar", 2], ["foo", 12], ["updated_at", 2012-11-19 18:36:30 -0800], ["value", true]]
D, [2012-11-19T18:36:30.393572 #53057] DEBUG -- :    (0.7ms)  commit transaction

How to turn off this output?

I tried ActiveRecord::Base.logger = nil, but this doesn't seem to do anything.

Using sinatra-activerecord, rspec and guard.

like image 549
B Seven Avatar asked Nov 20 '12 02:11

B Seven


1 Answers

ActiveRecord::Base.logger.level = 1

Any value of 1 or greater works. I guess it may work for other databases as well.

Reference

like image 174
B Seven Avatar answered Sep 24 '22 19:09

B Seven