Commit 02b9e553 authored by Rajendra Kadam's avatar Rajendra Kadam

Use GitLab Applogger

This MR adds GitLab AppLogger
in some files in lib/gitlab and
also adds changelog for the change

Add changelog

Change type in changelog
parent 2186dc81
---
title: Use applogger in some files in lib/gitlab
merge_request: 41058
author: Rajendra Kadam
type: other
......@@ -117,7 +117,6 @@ module Gitlab
private
# rubocop:disable Gitlab/RailsLogger
def rate_limit!(rate_limiter, success:, login:)
return if skip_rate_limit?(login: login)
......@@ -132,12 +131,11 @@ module Gitlab
# This returns true when the failures are over the threshold and the IP
# is banned.
if rate_limiter.register_fail!
Rails.logger.info "IP #{rate_limiter.ip} failed to login " \
Gitlab::AppLogger.info "IP #{rate_limiter.ip} failed to login " \
"as #{login} but has been temporarily banned from Git auth"
end
end
end
# rubocop:enable Gitlab/RailsLogger
def skip_rate_limit?(login:)
CI_JOB_USER == login
......
......@@ -335,7 +335,7 @@ module Gitlab
end
rescue Prometheus::Client::LabelSetValidator::LabelSetError => err
# Ensure that errors in recording these metrics don't affect the operation of the application
Rails.logger.error("Unable to observe database transaction duration: #{err}") # rubocop:disable Gitlab/RailsLogger
Gitlab::AppLogger.error("Unable to observe database transaction duration: #{err}")
end
# MonkeyPatch for ActiveRecord::Base for adding observability
......
......@@ -59,7 +59,7 @@ module Gitlab
begin
CharlockHolmes::Converter.convert(message, detect[:encoding], 'UTF-8')
rescue ArgumentError => e
Rails.logger.warn("Ignoring error converting #{detect[:encoding]} into UTF8: #{e.message}") # rubocop:disable Gitlab/RailsLogger
Gitlab::AppLogger.warn("Ignoring error converting #{detect[:encoding]} into UTF8: #{e.message}")
''
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