From 12148c972390d3318303cc0378220d1ad09d1aff Mon Sep 17 00:00:00 2001 From: Miguel Veloso Date: Thu, 21 Feb 2019 15:51:37 +0000 Subject: [PATCH] Refactor LogContext for IntegrationEvent Handlers to include AppName --- .../OrderStartedIntegrationEventHandler.cs | 2 +- ...ductPriceChangedIntegrationEventHandler.cs | 2 +- ...aitingValidationIntegrationEventHandler.cs | 2 +- ...tusChangedToPaidIntegrationEventHandler.cs | 2 +- ...rLocationUpdatedIntegrationEventHandler.cs | 2 +- .../Commands/CancelOrderCommandHandler.cs | 7 +- .../Commands/IdentifiedCommandHandler.cs | 75 ++++++++++++++++--- ...ePeriodConfirmedIntegrationEventHandler.cs | 2 +- ...derPaymentFailedIntegrationEventHandler.cs | 2 +- ...rPaymentSuccededIntegrationEventHandler.cs | 2 +- ...erStockConfirmedIntegrationEventHandler.cs | 2 +- ...derStockRejectedIntegrationEventHandler.cs | 2 +- ...CheckoutAcceptedIntegrationEventHandler.cs | 2 +- ...angedToCancelledIntegrationEventHandler.cs | 2 +- ...tusChangedToPaidIntegrationEventHandler.cs | 2 +- ...ChangedToShippedIntegrationEventHandler.cs | 2 +- ...ToStockConfirmedIntegrationEventHandler.cs | 2 +- ...angedToSubmittedIntegrationEventHandler.cs | 2 +- ...aitingValidationIntegrationEventHandler.cs | 2 +- ...ToStockConfirmedIntegrationEventHandler.cs | 2 +- 20 files changed, 88 insertions(+), 30 deletions(-) diff --git a/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs b/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs index cfac65465..9d84b328f 100644 --- a/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs +++ b/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs @@ -24,7 +24,7 @@ namespace Basket.API.IntegrationEvents.EventHandling public async Task Handle(OrderStartedIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/ProductPriceChangedIntegrationEventHandler.cs b/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/ProductPriceChangedIntegrationEventHandler.cs index 5e25cda3e..8bfa9a66a 100644 --- a/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/ProductPriceChangedIntegrationEventHandler.cs +++ b/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/ProductPriceChangedIntegrationEventHandler.cs @@ -24,7 +24,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Even public async Task Handle(ProductPriceChangedIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToAwaitingValidationIntegrationEventHandler.cs b/src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToAwaitingValidationIntegrationEventHandler.cs index 6932189a5..eee8c1778 100644 --- a/src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToAwaitingValidationIntegrationEventHandler.cs +++ b/src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToAwaitingValidationIntegrationEventHandler.cs @@ -30,7 +30,7 @@ public async Task Handle(OrderStatusChangedToAwaitingValidationIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToPaidIntegrationEventHandler.cs b/src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToPaidIntegrationEventHandler.cs index 524a907f6..eea7823a7 100644 --- a/src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToPaidIntegrationEventHandler.cs +++ b/src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToPaidIntegrationEventHandler.cs @@ -23,7 +23,7 @@ public async Task Handle(OrderStatusChangedToPaidIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Marketing/Marketing.API/IntegrationEvents/Handlers/UserLocationUpdatedIntegrationEventHandler.cs b/src/Services/Marketing/Marketing.API/IntegrationEvents/Handlers/UserLocationUpdatedIntegrationEventHandler.cs index 3025b6daa..4ffa6c34e 100644 --- a/src/Services/Marketing/Marketing.API/IntegrationEvents/Handlers/UserLocationUpdatedIntegrationEventHandler.cs +++ b/src/Services/Marketing/Marketing.API/IntegrationEvents/Handlers/UserLocationUpdatedIntegrationEventHandler.cs @@ -26,7 +26,7 @@ public async Task Handle(UserLocationUpdatedIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/CancelOrderCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/CancelOrderCommandHandler.cs index a4c4facb8..85858486c 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/CancelOrderCommandHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/CancelOrderCommandHandler.cs @@ -2,6 +2,7 @@ using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency; +using Microsoft.Extensions.Logging; using System.Threading; using System.Threading.Tasks; @@ -40,7 +41,11 @@ namespace Ordering.API.Application.Commands // Use for Idempotency in Command process public class CancelOrderIdentifiedCommandHandler : IdentifiedCommandHandler { - public CancelOrderIdentifiedCommandHandler(IMediator mediator, IRequestManager requestManager) : base(mediator, requestManager) + public CancelOrderIdentifiedCommandHandler( + IMediator mediator, + IRequestManager requestManager, + ILogger> logger) + : base(mediator, requestManager, logger) { } diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs index f00ea44c8..e1fdc43ef 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs @@ -1,5 +1,9 @@ using MediatR; using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency; +using Microsoft.Extensions.Logging; +using Ordering.API.Application.Behaviors; +using Ordering.API.Application.Commands; +using System; using System.Threading; using System.Threading.Tasks; @@ -16,11 +20,16 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands { private readonly IMediator _mediator; private readonly IRequestManager _requestManager; + private readonly ILogger> _logger; - public IdentifiedCommandHandler(IMediator mediator, IRequestManager requestManager) + public IdentifiedCommandHandler( + IMediator mediator, + IRequestManager requestManager, + ILogger> logger) { _mediator = mediator; _requestManager = requestManager; + _logger = logger ?? throw new System.ArgumentNullException(nameof(logger)); } /// @@ -48,16 +57,60 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands else { await _requestManager.CreateRequestForCommandAsync(message.Id); - try - { - // Send the embeded business command to mediator so it runs its related CommandHandler - var result = await _mediator.Send(message.Command); - return result; - } - catch - { - return default(R); - } + try + { + var command = message.Command; + var commandName = command.GetGenericTypeName(); + var idProperty = string.Empty; + var commandId = string.Empty; + + switch (command) + { + case CreateOrderCommand createOrderCommand: + idProperty = nameof(createOrderCommand.UserId); + commandId = createOrderCommand.UserId; + break; + + case CancelOrderCommand cancelOrderCommand: + idProperty = nameof(cancelOrderCommand.OrderNumber); + commandId = $"{cancelOrderCommand.OrderNumber}"; + break; + + case ShipOrderCommand shipOrderCommand: + idProperty = nameof(shipOrderCommand.OrderNumber); + commandId = $"{shipOrderCommand.OrderNumber}"; + break; + + default: + idProperty = "Id?"; + commandId = "n/a"; + break; + } + + _logger.LogInformation( + "----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})", + commandName, + idProperty, + commandId, + command); + + // Send the embeded business command to mediator so it runs its related CommandHandler + var result = await _mediator.Send(command); + + _logger.LogInformation( + "----- Command result: {@Result} - {CommandName} - {IdProperty}: {CommandId} ({@Command})", + result, + commandName, + idProperty, + commandId, + command); + + return result; + } + catch + { + return default(R); + } } } } diff --git a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/GracePeriodConfirmedIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/GracePeriodConfirmedIntegrationEventHandler.cs index 11fb268f6..275f177cc 100644 --- a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/GracePeriodConfirmedIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/GracePeriodConfirmedIntegrationEventHandler.cs @@ -33,7 +33,7 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling /// public async Task Handle(GracePeriodConfirmedIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentFailedIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentFailedIntegrationEventHandler.cs index 8d1aeb93e..198ad790d 100644 --- a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentFailedIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentFailedIntegrationEventHandler.cs @@ -27,7 +27,7 @@ public async Task Handle(OrderPaymentFailedIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentSuccededIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentSuccededIntegrationEventHandler.cs index 3e2a7a5af..7eb32cd06 100644 --- a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentSuccededIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentSuccededIntegrationEventHandler.cs @@ -27,7 +27,7 @@ public async Task Handle(OrderPaymentSuccededIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockConfirmedIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockConfirmedIntegrationEventHandler.cs index 9af42e825..af1ec605a 100644 --- a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockConfirmedIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockConfirmedIntegrationEventHandler.cs @@ -27,7 +27,7 @@ public async Task Handle(OrderStockConfirmedIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockRejectedIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockRejectedIntegrationEventHandler.cs index f4f01a205..35202a257 100644 --- a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockRejectedIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockRejectedIntegrationEventHandler.cs @@ -26,7 +26,7 @@ public async Task Handle(OrderStockRejectedIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/UserCheckoutAcceptedIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/UserCheckoutAcceptedIntegrationEventHandler.cs index 5598f462f..a7fa23bcb 100644 --- a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/UserCheckoutAcceptedIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/UserCheckoutAcceptedIntegrationEventHandler.cs @@ -34,7 +34,7 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling /// public async Task Handle(UserCheckoutAcceptedIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToCancelledIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToCancelledIntegrationEventHandler.cs index 69f70e44e..77e112f74 100644 --- a/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToCancelledIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToCancelledIntegrationEventHandler.cs @@ -26,7 +26,7 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling public async Task Handle(OrderStatusChangedToCancelledIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToPaidIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToPaidIntegrationEventHandler.cs index 510438473..56fcde670 100644 --- a/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToPaidIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToPaidIntegrationEventHandler.cs @@ -24,7 +24,7 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling public async Task Handle(OrderStatusChangedToPaidIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToShippedIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToShippedIntegrationEventHandler.cs index 4c056a484..be32d49c8 100644 --- a/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToShippedIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToShippedIntegrationEventHandler.cs @@ -26,7 +26,7 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling public async Task Handle(OrderStatusChangedToShippedIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs index 3a7c7cc96..695cf5b36 100644 --- a/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs @@ -27,7 +27,7 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling public async Task Handle(OrderStatusChangedToStockConfirmedIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToSubmittedIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToSubmittedIntegrationEventHandler.cs index 08532b07f..07bb60d16 100644 --- a/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToSubmittedIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/OrderStatusChangedToSubmittedIntegrationEventHandler.cs @@ -27,7 +27,7 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling public async Task Handle(OrderStatusChangedToSubmittedIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/orderStatusChangedToAwaitingValidationIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/orderStatusChangedToAwaitingValidationIntegrationEventHandler.cs index 126a05c7e..b134bfda6 100644 --- a/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/orderStatusChangedToAwaitingValidationIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/EventHandling/orderStatusChangedToAwaitingValidationIntegrationEventHandler.cs @@ -25,7 +25,7 @@ namespace Ordering.SignalrHub.IntegrationEvents public async Task Handle(OrderStatusChangedToAwaitingValidationIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); diff --git a/src/Services/Payment/Payment.API/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs b/src/Services/Payment/Payment.API/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs index 5eca92b6e..8dc4dd6d8 100644 --- a/src/Services/Payment/Payment.API/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs +++ b/src/Services/Payment/Payment.API/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs @@ -27,7 +27,7 @@ public async Task Handle(OrderStatusChangedToStockConfirmedIntegrationEvent @event) { - using (LogContext.PushProperty("IntegrationEventIdContext", @event.Id)) + using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppShortName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event);