From 0bbd9e281f903609e35103447354d00c07fdd231 Mon Sep 17 00:00:00 2001 From: Ahmad Farhat <ahmad.af.farhat@gmail.com> Date: Wed, 15 Nov 2023 11:36:32 -0500 Subject: [PATCH] Remove active_record_serializer logs in prod (#5520) --- Gemfile.lock | 6 ------ config/environments/production.rb | 10 +++------- .../initializers/active_model_serializers.rb | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 config/initializers/active_model_serializers.rb diff --git a/Gemfile.lock b/Gemfile.lock index c397e10c..beccedf9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -538,9 +538,3 @@ DEPENDENCIES web-console (>= 4.2.1) webdrivers webmock - -RUBY VERSION - ruby 3.0.0p0 - -BUNDLED WITH - 2.2.3 diff --git a/config/environments/production.rb b/config/environments/production.rb index 9e785e50..9f91ad5d 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -135,17 +135,13 @@ Rails.application.configure do # require "syslog/logger" # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") - if ENV['RAILS_LOG_TO_STDOUT'].present? - $stdout.sync = true - logger = ActiveSupport::Logger.new($stdout) - logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) - end - if ENV['RAILS_LOG_REMOTE_NAME'] && ENV['RAILS_LOG_REMOTE_PORT'] require 'remote_syslog_logger' logger_program = ENV['RAILS_LOG_REMOTE_TAG'] || "greenlight-v3-#{ENV.fetch('RAILS_ENV', nil)}" logger = RemoteSyslogLogger.new(ENV['RAILS_LOG_REMOTE_NAME'], ENV['RAILS_LOG_REMOTE_PORT'], program: logger_program) + else + $stdout.sync = true + logger = ActiveSupport::Logger.new($stdout) end logger.formatter = config.log_formatter diff --git a/config/initializers/active_model_serializers.rb b/config/initializers/active_model_serializers.rb new file mode 100644 index 00000000..4b0fa598 --- /dev/null +++ b/config/initializers/active_model_serializers.rb @@ -0,0 +1,19 @@ +# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. +# +# Copyright (c) 2022 BigBlueButton Inc. and by respective authors (see below). +# +# This program is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free Software +# Foundation; either version 3.0 of the License, or (at your option) any later +# version. +# +# Greenlight is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License along +# with Greenlight; if not, see <http://www.gnu.org/licenses/>. + +# frozen_string_literal: true + +ActiveModelSerializers.logger = Logger.new(IO::NULL) if Rails.env.production? -- GitLab