Skip to content Skip to sidebar Skip to footer

How Do I Turn Off The Sqlite3 'sqlite_master' Logging In Rails?

My development log fills up with SELECT name FROM sqlite_master WHERE type = 'table' AND NOT name = 'sqlite_sequence' I'd like to turn off the sqlite_master queries in sqli

Solution 1:

Here's how I fixed it. Perhaps there are better options.

Tested only on Rails 2.3.8.

I added a log_info method to the SQLiteAdapter class in the activerecord gem, which overrides the same method in AbstractAdapter.

deflog_info(sql, name, ms)unless sql.match(/sqlite_master/)
          if@logger && @logger.debug?
            name = '%s (%.1fms)' % [name ||'SQL', ms]
            @logger.debug(format_log_entry(name, sql.squeeze(' ')))
          endendend

so, any sql statement that contains 'sqlite_master' is not logged.

Post a Comment for "How Do I Turn Off The Sqlite3 'sqlite_master' Logging In Rails?"