How to disable sqlite3 'sqlite_master' logging in rails?

My development log is populating

SELECT name FROM sqlite_master WHERE type = 'table' AND NOT name = 'Sqlite_sequence'

I would like to disable sqlite_master queries in sqlite3, so that I only see interesting queries.

+4
source share
1 answer

This is how I fixed it. Perhaps there are better options.

Tested only on Rails 2.3.8.

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

      def log_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(' ')))
          end
        end
      end

therefore, any sql statement containing "sqlite_master" is not logged.

+2
source

All Articles