如何使用Active Record在Sinatra中沉默SQLite3记录器?

B S*_*ven 5 sqlite logging activerecord rspec sinatra

保护输出窗口填满

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
Run Code Online (Sandbox Code Playgroud)

如何关闭此输出?

我试过了ActiveRecord::Base.logger = nil,但这似乎没有做任何事情.

使用sinatra-activerecord,rspecguard.

B S*_*ven 8

ActiveRecord::Base.logger.level = 1
Run Code Online (Sandbox Code Playgroud)

任何1或更大的值都有效.我想它也适用于其他数据库.

参考