我正在尝试在生产中将记录器级别更改为:warn
,但没有成功。
这就是我所拥有的:
# config/environments/production.rb
# removed unrelated lines
Rails.application.configure do
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
# :debug, :info, :warn, :error, :fatal, and :unknown
config.log_level = :warn
# Prepend all log lines with the following tags.
config.log_tags = [:request_id]
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV['RAILS_LOG_TO_STDOUT'].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
logger.level = :warn
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
end
我也有这些ENV变量:
LOG_LEVEL: WARN
RAILS_LOG_TO_STDOUT: enabled
RAILS_SERVE_STATIC_FILES: enabled
请注意,我没有STDOUT.sync = true
。这似乎无关。我需要添加吗?
我想念什么?