Draft: Gitlab::AppLogger set as Rails.logger
What does this MR do and why?
Part of https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/2145, gitlab-com/gl-infra/scalability#2192.
Rails.logger
should use Gitlab::AppLogger
:
$ gdk rails c
--------------------------------------------------------------------------------
Ruby: ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c5) [arm64-darwin21]
GitLab: 15.10.0-pre (4c69b7d724c) EE
GitLab Shell: 14.17.0
PostgreSQL: 12.13
--------------------------------------------------------------------------------
Loading development environment (Rails 6.1.7.2)
[1] pry(main)> Rails.logger.fatal 'hello logger'
=> [Gitlab::AppJsonLogger]
[2] pry(main)> Rails.logger.info 'hello logger again'
=> [Gitlab::AppJsonLogger]
[3] pry(main)>
Correctly outputting to the logfile in the right format:
$ tail -n 2 log/application_json.log
{"severity":"ERROR","time":"2023-02-24T14:59:41.490Z","correlation_id":null,"message":"hello logger"}
{"severity":"INFO","time":"2023-02-24T15:00:22.231Z","correlation_id":null,"message":"hello logger again"}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Hercules Merscher