1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Use of logger outside of Sidekiq server process, fixes #3714

This commit is contained in:
Mike Perham 2018-01-10 10:04:09 -08:00
parent b56afeec1a
commit e72d51b343
2 changed files with 7 additions and 3 deletions

View file

@ -11,7 +11,7 @@ module Sidekiq
# Provide a call() method that returns the formatted message.
def call(severity, time, program_name, message)
"#{time.utc.iso8601(3)} #{::Process.pid} TID-#{Sidekiq::Util.tid}#{context} #{severity}: #{message}\n"
"#{time.utc.iso8601(3)} #{::Process.pid} TID-#{Sidekiq::Logging.tid}#{context} #{severity}: #{message}\n"
end
def context
@ -22,10 +22,14 @@ module Sidekiq
class WithoutTimestamp < Pretty
def call(severity, time, program_name, message)
"#{::Process.pid} TID-#{Sidekiq::Util.tid}#{context} #{severity}: #{message}\n"
"#{::Process.pid} TID-#{Sidekiq::Logging.tid}#{context} #{severity}: #{message}\n"
end
end
def self.tid
Thread.current['sidekiq_tid'] ||= (Thread.current.object_id ^ ::Process.pid).to_s(36)
end
def self.job_hash_context(job_hash)
# If we're using a wrapper class, like ActiveJob, use the "wrapped"
# attribute to expose the underlying thing.

View file

@ -191,7 +191,7 @@ module Sidekiq
FAILURE = Concurrent::AtomicFixnum.new
def stats(job_hash, queue)
tid = Sidekiq::Util.tid
tid = Sidekiq::Logging.tid
WORKER_STATE[tid] = {:queue => queue, :payload => job_hash, :run_at => Time.now.to_i }
begin