Replace ActiveSupport::Logger with DiscourseLogstashLogger when enabled.

This commit is contained in:
Guo Xiang Tan 2018-04-13 12:08:27 +08:00
parent e43baafa02
commit a902d5b27f
1 changed files with 5 additions and 0 deletions

View File

@ -96,6 +96,11 @@ if (Rails.env.production? && SiteSetting.logging_provider == 'lograge') || ENV["
config.lograge.logger = DiscourseLogstashLogger.logger( config.lograge.logger = DiscourseLogstashLogger.logger(
uri: ENV['LOGSTASH_URI'], type: :rails uri: ENV['LOGSTASH_URI'], type: :rails
) )
# Remove ActiveSupport::Logger from the chain and replace with Lograge's
# logger
Rails.logger.instance_variable_get(:@chained).pop
Rails.logger.chain(config.lograge.logger)
end end
end end
end end