From 3ae3234f670a63104d327fdccda6a4a1e6e43cbd Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sat, 1 Feb 2020 07:58:09 +0100 Subject: [PATCH] silence logging #405 --- config/application.rb | 5 ++++- config/initializers/_lograge.rb | 6 ++++-- config/initializers/sentry.rb | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config/application.rb b/config/application.rb index ea14312f9..1a9a783ff 100644 --- a/config/application.rb +++ b/config/application.rb @@ -106,7 +106,10 @@ class Application < Rails::Application # } # end # config.logger = config.lograge.logger - # config.active_record.logger = nil + + # Disable loggers that log to file + config.active_record.logger = nil + config.active_job.logger = nil # configure caching config.cache_store = :dalli_store, nil, { :namespace => ENV['APPLICATION'] } diff --git a/config/initializers/_lograge.rb b/config/initializers/_lograge.rb index eb6693412..4065e2caa 100644 --- a/config/initializers/_lograge.rb +++ b/config/initializers/_lograge.rb @@ -6,9 +6,9 @@ config.lograge.enabled = true config.lograge.formatter = Lograge::Formatters::Logstash.new config.lograge.logger = LogStashLogger.new(type: :stdout) + config.logger = config.lograge.logger config.lograge.log_level = ENV["LOG_LEVEL"].to_sym - - config.active_job.logger = config.lograge.logger + config.logger = config.lograge.logger config.lograge.ignore_actions = ["HeartbeatController#index", "IndexController#index"] config.lograge.ignore_custom = lambda do |event| @@ -24,3 +24,5 @@ } end end + +Rails.cache.silence! diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index 343a9eef6..71f67acd1 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -7,4 +7,5 @@ # ignore 502, 503 and 504 from Elasticsearch config.excluded_exceptions += ['Elasticsearch::Transport::Transport::Errors::BadGateway', 'Elasticsearch::Transport::Transport::Errors::ServiceUnavailable', 'Elasticsearch::Transport::Transport::Errors::GatewayTimeout'] + config.logger = Rails.application.config.lograge.logger end