From a402622dd6cd4c5f554f0bfc5be9b968bfd3788d Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Mon, 11 Mar 2024 13:45:08 -0400 Subject: [PATCH] Fix missing log service name for non-rails event catcher The non-rails event catcher was not setting the progname for the ManageIQ::Loggers instance which defaulted to `"manageiq"`. This meant that the event catcher logging would be missed if you were e.g. `journalctl -f -t evm` --- workers/event_catcher/event_catcher.rb | 7 ++++--- workers/event_catcher/worker | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/workers/event_catcher/event_catcher.rb b/workers/event_catcher/event_catcher.rb index de718eca4..d28e07574 100644 --- a/workers/event_catcher/event_catcher.rb +++ b/workers/event_catcher/event_catcher.rb @@ -18,17 +18,18 @@ def run! notify_started - logger.info("Collecting events...") + log_prefix = "MIQ(ManageIQ::Providers::Vmware::InfraManager::EventCatcher)".freeze + logger.info("#{log_prefix} Collecting events...") wait_for_updates(vim) do |property_change| - logger.info(property_change.name) + logger.info("#{log_prefix} #{property_change.name}") next unless property_change.name.match?(/latestPage.*/) events = Array(property_change.val).map do |event| EventParser.parse_event(event).merge(:ems_id => ems["id"]) end - logger.info(events.to_json) + logger.info("#{log_prefix} events: [#{events.to_json}]") publish_events(events) end diff --git a/workers/event_catcher/worker b/workers/event_catcher/worker index b47469d74..b5873804e 100755 --- a/workers/event_catcher/worker +++ b/workers/event_catcher/worker @@ -35,7 +35,9 @@ end def main(args) setproctitle - logger = build_logger + logger = build_logger + logger.progname = "evm" + ems = args["ems"].detect { |e| e["type"] == "ManageIQ::Providers::Vmware::InfraManager" } messaging = args["messaging"].symbolize_keys endpoint = ems["endpoints"].detect { |ep| ep["role"] == "default" }