Skip to content

Commit

Permalink
Use tracking label for logging
Browse files Browse the repository at this point in the history
If there is a tracking label (new) then lets log this

Use the global MiqQueue#task_id for backwards compatibility.
  • Loading branch information
kbrock committed Jun 22, 2017
1 parent 838e3e0 commit 507d4c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/gems/pending/util/vmdb-logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ def call(severity, time, progname, msg)

def prefix_task_id(msg)
# Add task id to the message if a task is currently being worked on.
if $_miq_worker_current_msg && !$_miq_worker_current_msg.task_id.nil?
prefix = "Q-task_id([#{$_miq_worker_current_msg.task_id}])"
if (task_id = (Thread.current["tracking_label"] || $_miq_worker_current_msg.try(:task_id)))
prefix = "Q-task_id([#{task_id}])"
msg = "#{prefix} #{msg}" unless msg.include?(prefix)
end

Expand Down

0 comments on commit 507d4c7

Please sign in to comment.