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 ...@@ -117,7 +117,6 @@ module Gitlab
private private
# rubocop:disable Gitlab/RailsLogger
def rate_limit!(rate_limiter, success:, login:) def rate_limit!(rate_limiter, success:, login:)
return if skip_rate_limit?(login: login) return if skip_rate_limit?(login: login)
...@@ -132,12 +131,11 @@ module Gitlab ...@@ -132,12 +131,11 @@ module Gitlab
# This returns true when the failures are over the threshold and the IP # This returns true when the failures are over the threshold and the IP
# is banned. # is banned.
if rate_limiter.register_fail! 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" "as #{login} but has been temporarily banned from Git auth"
end end
end end
end end
# rubocop:enable Gitlab/RailsLogger
def skip_rate_limit?(login:) def skip_rate_limit?(login:)
CI_JOB_USER == login CI_JOB_USER == login
......
...@@ -335,7 +335,7 @@ module Gitlab ...@@ -335,7 +335,7 @@ module Gitlab
end end
rescue Prometheus::Client::LabelSetValidator::LabelSetError => err rescue Prometheus::Client::LabelSetValidator::LabelSetError => err
# Ensure that errors in recording these metrics don't affect the operation of the application # 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 end
# MonkeyPatch for ActiveRecord::Base for adding observability # MonkeyPatch for ActiveRecord::Base for adding observability
......
...@@ -59,7 +59,7 @@ module Gitlab ...@@ -59,7 +59,7 @@ module Gitlab
begin begin
CharlockHolmes::Converter.convert(message, detect[:encoding], 'UTF-8') CharlockHolmes::Converter.convert(message, detect[:encoding], 'UTF-8')
rescue ArgumentError => e 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 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