Chained commands keep the same CommandId in nlog context

This commit is contained in:
Mark McDowall 2013-09-03 22:02:26 -07:00
parent c184ec2d98
commit 1166a81eb3
1 changed files with 4 additions and 1 deletions

View File

@ -144,8 +144,11 @@ namespace NzbDrone.Common.Messaging
var sw = Stopwatch.StartNew(); var sw = Stopwatch.StartNew();
try try
{
if (!MappedDiagnosticsContext.Contains("CommandId"))
{ {
MappedDiagnosticsContext.Set("CommandId", trackedCommand.Command.CommandId); MappedDiagnosticsContext.Set("CommandId", trackedCommand.Command.CommandId);
}
PublishEvent(new CommandStartedEvent(trackedCommand)); PublishEvent(new CommandStartedEvent(trackedCommand));
handler.Execute(command); handler.Execute(command);