Commit 4917fa3f authored by Rajendra Kadam's avatar Rajendra Kadam Committed by Peter Leitzen

Use applogger in ee/app/helpers, models and services

parent c78115d4
---
title: Use applogger in ee/app/models, helpers and workers
merge_request: 41048
author: Rajendra Kadam
type: other
...@@ -82,7 +82,7 @@ module EE ...@@ -82,7 +82,7 @@ module EE
# Return user principal name if authentication succeeded # Return user principal name if authentication succeeded
gss.display_name gss.display_name
rescue GSSAPI::GssApiError => ex rescue GSSAPI::GssApiError => ex
Rails.logger.error "#{self.class.name}: failed to process Negotiate/Kerberos authentication: #{ex.message}" # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.error "#{self.class.name}: failed to process Negotiate/Kerberos authentication: #{ex.message}"
false false
end end
......
...@@ -232,7 +232,7 @@ class GeoNode < ApplicationRecord ...@@ -232,7 +232,7 @@ class GeoNode < ApplicationRecord
# be called in an initializer and we don't want other callbacks # be called in an initializer and we don't want other callbacks
# to mess with uninitialized dependencies. # to mess with uninitialized dependencies.
if clone_url_prefix_changed? if clone_url_prefix_changed?
Rails.logger.info "Geo: modified clone_url_prefix to #{clone_url_prefix}" # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.info "Geo: modified clone_url_prefix to #{clone_url_prefix}"
update_column(:clone_url_prefix, clone_url_prefix) update_column(:clone_url_prefix, clone_url_prefix)
end end
end end
......
...@@ -21,7 +21,7 @@ class FetchSubscriptionPlansService ...@@ -21,7 +21,7 @@ class FetchSubscriptionPlansService
Gitlab::Json.parse(response.body).map { |plan| Hashie::Mash.new(plan) } Gitlab::Json.parse(response.body).map { |plan| Hashie::Mash.new(plan) }
rescue => e rescue => e
Rails.logger.info "Unable to connect to GitLab Customers App #{e}" # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.info "Unable to connect to GitLab Customers App #{e}"
nil nil
end end
......
...@@ -8,18 +8,16 @@ class LdapSyncWorker # rubocop:disable Scalability/IdempotentWorker ...@@ -8,18 +8,16 @@ class LdapSyncWorker # rubocop:disable Scalability/IdempotentWorker
worker_has_external_dependencies! worker_has_external_dependencies!
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable Gitlab/RailsLogger
def perform def perform
return unless Gitlab::Auth::Ldap::Config.group_sync_enabled? return unless Gitlab::Auth::Ldap::Config.group_sync_enabled?
Rails.logger.info "Performing daily LDAP sync task." Gitlab::AppLogger.info "Performing daily LDAP sync task."
User.ldap.find_each(batch_size: 100).each do |ldap_user| User.ldap.find_each(batch_size: 100).each do |ldap_user|
Rails.logger.debug "Syncing user #{ldap_user.username}, #{ldap_user.email}" Gitlab::AppLogger.debug "Syncing user #{ldap_user.username}, #{ldap_user.email}"
# Use the 'update_ldap_group_links_synchronously' option to avoid creating a ton # Use the 'update_ldap_group_links_synchronously' option to avoid creating a ton
# of new Sidekiq jobs all at once. # of new Sidekiq jobs all at once.
Gitlab::Auth::Ldap::Access.allowed?(ldap_user, update_ldap_group_links_synchronously: true) Gitlab::Auth::Ldap::Access.allowed?(ldap_user, update_ldap_group_links_synchronously: true)
end end
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable Gitlab/RailsLogger
end end
...@@ -21,7 +21,7 @@ class PseudonymizerWorker # rubocop:disable Scalability/IdempotentWorker ...@@ -21,7 +21,7 @@ class PseudonymizerWorker # rubocop:disable Scalability/IdempotentWorker
uploader = Pseudonymizer::Uploader.new(options, progress_output: File.open(File::NULL, "w")) uploader = Pseudonymizer::Uploader.new(options, progress_output: File.open(File::NULL, "w"))
unless uploader.available? unless uploader.available?
Rails.logger.error("The pseudonymizer object storage must be configured.") # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.error("The pseudonymizer object storage must be configured.")
return return
end end
......
...@@ -26,7 +26,7 @@ RSpec.describe FetchSubscriptionPlansService do ...@@ -26,7 +26,7 @@ RSpec.describe FetchSubscriptionPlansService do
end end
it 'logs failure' do it 'logs failure' do
expect(Rails).to receive_message_chain(:logger, :info).with('Unable to connect to GitLab Customers App Error message') expect(Gitlab::AppLogger).to receive(:info).with('Unable to connect to GitLab Customers App Error message')
subject subject
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment