Skip to content

Commit

Permalink
Refs #28384 - handle case when request ID is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
jturel authored and ehelms committed Aug 7, 2020
1 parent 9df1c2b commit d5ae868
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/foreman/logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,18 @@ def indent_lines(string)
end

class MultilineRequestPatternLayout < MultilinePatternLayout
private

def indent_lines(string)
string.gsub("\n", "\n #{::Logging.mdc['request'].split('-').first} | ")
if request_id
string.gsub("\n", "\n #{request_id.split('-').first} | ")
else
super(string)
end
end

def request_id
::Logging.mdc['request']
end
end
end
Expand Down

0 comments on commit d5ae868

Please sign in to comment.