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:
Alan Guo Xiang Tan
2024-07-09 10:00:44 +08:00
committed by GitHub
parent 3aaece3235
commit c0ac15575f
3 changed files with 27 additions and 28 deletions

View File

@@ -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,7 +143,6 @@ if (Rails.env.production? && SiteSetting.logging_provider == "lograge") ||
end
end
if ENV["ENABLE_LOGSTASH_LOGGER"] == "1"
config.lograge.formatter = Lograge::Formatters::Logstash.new
require "discourse_logstash_logger"
@@ -154,9 +152,7 @@ if (Rails.env.production? && SiteSetting.logging_provider == "lograge") ||
logdev: Rails.root.join("log", "#{Rails.env}.log"),
type: :rails,
customize_event:
lambda do |event|
event["database"] = RailsMultisite::ConnectionManagement.current_db
end,
lambda { |event| event["database"] = RailsMultisite::ConnectionManagement.current_db },
)
# Stop broadcasting to Rails' default logger
@@ -170,4 +166,3 @@ if (Rails.env.production? && SiteSetting.logging_provider == "lograge") ||
end
end
end
end

View File

@@ -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

View File

@@ -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