papertrail / remote_syslog_logger

Ruby Logger that sends directly to a remote syslog endpoint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enabling remote_syslog_logger turns on sql logging

edmz opened this issue · comments

commented

In production.rb I have...

config.logger = ActiveSupport::TaggedLogging.new(...)
config.colorize_logging = false
config.log_level = :info

But then, I start seeing SQL statements in the logs. Adding the following will cause nil errors:

config.active_record.logger = nil

What's the recommended way to stop activerecord from outputing sql statements?

This is for a Rails legacy site running v3.2.X.

Thanks in advance.

commented

(Sorry, this is clearly not a bug but I haven't found the way yet).

@edmz your change to the log level isn't getting propagated to ActiveRecord's instance of Logger, often because the Logger is being overwritten elsewhere or because production.rb isn't being read in the environment generating these logs. Whatever the cause, ActiveRecord::Base.logger is still at debug level. One way to verify and work around this would be to set its log level manually at the end of the rails initializers, like the second example here: http://guides.rubyonrails.org/v2.3.11/debugging_rails_applications.html#log-levels