Commit a7d9ca79 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'sh-format-sidekiq-cluster-logs' into 'master'

Ensure sidekiq-cluster emits JSON logs

See merge request gitlab-org/gitlab!26484
parents b90db6bf 8dfa31b1
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
require 'optparse' require 'optparse'
require 'logger' require 'logger'
require 'time' require 'time'
require_relative '../../../../lib/gitlab/sidekiq_logging/json_formatter'
module Gitlab module Gitlab
module SidekiqCluster module SidekiqCluster
...@@ -24,13 +25,9 @@ module Gitlab ...@@ -24,13 +25,9 @@ module Gitlab
@alive = true @alive = true
@processes = [] @processes = []
@logger = Logger.new(log_output) @logger = Logger.new(log_output)
@logger.formatter = ::Gitlab::SidekiqLogging::JSONFormatter.new
@rails_path = Dir.pwd @rails_path = Dir.pwd
@dryrun = false @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 end
def run(argv = ARGV) def run(argv = ARGV)
......
# frozen_string_literal: true # frozen_string_literal: true
# This is needed for sidekiq-cluster
require 'json'
module Gitlab module Gitlab
module SidekiqLogging module SidekiqLogging
class JSONFormatter 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