Commit 8dfa31b1 authored by Stan Hu's avatar Stan Hu

Ensure sidekiq-cluster emits JSON logs

We can just re-use the Sidekiq JSON formatter to ensure this happens
since sidekiq-cli doesn't use the Sidekiq initializer.

Part of https://gitlab.com/gitlab-org/gitlab/issues/208922
parent a89d86f0
......@@ -3,6 +3,7 @@
require 'optparse'
require 'logger'
require 'time'
require_relative '../../../../lib/gitlab/sidekiq_logging/json_formatter'
module Gitlab
module SidekiqCluster
......@@ -24,13 +25,9 @@ module Gitlab
@alive = true
@processes = []
@logger = Logger.new(log_output)
@logger.formatter = ::Gitlab::SidekiqLogging::JSONFormatter.new
@rails_path = Dir.pwd
@dryrun = false
# Use a log format similar to Sidekiq to make parsing/grepping easier.
@logger.formatter = proc do |level, date, program, message|
"#{date.utc.iso8601(3)} #{Process.pid} TID-#{Thread.current.object_id.to_s(36)} #{level}: #{message}\n"
end
end
def run(argv = ARGV)
......
# frozen_string_literal: true
# This is needed for sidekiq-cluster
require 'json'
module Gitlab
module SidekiqLogging
class JSONFormatter
......
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