DEV: Drop `logging_provider` site setting (#27785)
This site setting has always been experimental and hidden since it was added 7 years ago. Drop it to simplify the way we enable logging in a logstash friendly way.
This commit is contained in:
parent
3aaece3235
commit
c0ac15575f
|
@ -1,7 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
if (Rails.env.production? && SiteSetting.logging_provider == "lograge") ||
|
||||
(ENV["ENABLE_LOGRAGE"] == "1")
|
||||
if ENV["ENABLE_LOGSTASH_LOGGER"] == "1"
|
||||
require "lograge"
|
||||
|
||||
Rails.application.config.after_initialize do
|
||||
|
@ -144,29 +143,25 @@ if (Rails.env.production? && SiteSetting.logging_provider == "lograge") ||
|
|||
end
|
||||
end
|
||||
|
||||
if ENV["ENABLE_LOGSTASH_LOGGER"] == "1"
|
||||
config.lograge.formatter = Lograge::Formatters::Logstash.new
|
||||
config.lograge.formatter = Lograge::Formatters::Logstash.new
|
||||
|
||||
require "discourse_logstash_logger"
|
||||
require "discourse_logstash_logger"
|
||||
|
||||
config.lograge.logger =
|
||||
DiscourseLogstashLogger.logger(
|
||||
logdev: Rails.root.join("log", "#{Rails.env}.log"),
|
||||
type: :rails,
|
||||
customize_event:
|
||||
lambda do |event|
|
||||
event["database"] = RailsMultisite::ConnectionManagement.current_db
|
||||
end,
|
||||
)
|
||||
|
||||
# Stop broadcasting to Rails' default logger
|
||||
Rails.logger.stop_broadcasting_to(
|
||||
Rails.logger.broadcasts.find { |logger| logger.is_a?(ActiveSupport::Logger) },
|
||||
config.lograge.logger =
|
||||
DiscourseLogstashLogger.logger(
|
||||
logdev: Rails.root.join("log", "#{Rails.env}.log"),
|
||||
type: :rails,
|
||||
customize_event:
|
||||
lambda { |event| event["database"] = RailsMultisite::ConnectionManagement.current_db },
|
||||
)
|
||||
|
||||
Logster.logger.subscribe do |severity, message, progname, opts, &block|
|
||||
config.lograge.logger.add_with_opts(severity, message, progname, opts, &block)
|
||||
end
|
||||
# Stop broadcasting to Rails' default logger
|
||||
Rails.logger.stop_broadcasting_to(
|
||||
Rails.logger.broadcasts.find { |logger| logger.is_a?(ActiveSupport::Logger) },
|
||||
)
|
||||
|
||||
Logster.logger.subscribe do |severity, message, progname, opts, &block|
|
||||
config.lograge.logger.add_with_opts(severity, message, progname, opts, &block)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2346,13 +2346,6 @@ developer:
|
|||
bypass_wizard_check:
|
||||
default: false
|
||||
hidden: true
|
||||
logging_provider:
|
||||
hidden: true
|
||||
default: "default"
|
||||
type: "list"
|
||||
choices:
|
||||
- "default"
|
||||
- "lograge"
|
||||
bootstrap_error_pages:
|
||||
hidden: true
|
||||
default: false
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RemoveLoggingProviderSiteSetting < ActiveRecord::Migration[7.1]
|
||||
def up
|
||||
execute "DELETE FROM site_settings WHERE name = 'logging_provider'"
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue