Skip to content

Commit f66b191

Browse files
committed
Revert "Extend logging categories to TaskOrchestrationContextWrapper (WIP)"
This reverts commit 2e02259.
1 parent bf8d1f3 commit f66b191

File tree

3 files changed

+4
-36
lines changed

3 files changed

+4
-36
lines changed

src/Worker/Core/Shims/TaskOrchestrationContextWrapper.cs

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public TaskOrchestrationContextWrapper(
6363
this.invocationContext = Check.NotNull(invocationContext);
6464
this.Properties = Check.NotNull(properties);
6565

66-
this.logger = this.CreateReplaySafeLogger("Microsoft.DurableTask.Worker.Orchestration");
66+
this.logger = this.CreateReplaySafeLogger("Microsoft.DurableTask");
6767
this.deserializedInput = deserializedInput;
6868
}
6969

@@ -541,30 +541,4 @@ string GetDefaultVersion()
541541

542542
return string.Empty;
543543
}
544-
545-
/// <inheritdoc/>
546-
public override ILogger CreateReplaySafeLogger(string categoryName)
547-
{
548-
// For orchestration logs, use dual-category logging if legacy categories are enabled
549-
if (categoryName == "Microsoft.DurableTask.Worker.Orchestration" &&
550-
this.invocationContext.Options.Logging.UseLegacyCategories)
551-
{
552-
ILogger primaryLogger = this.LoggerFactory.CreateLogger(categoryName);
553-
ILogger legacyLogger = this.LoggerFactory.CreateLogger("Microsoft.DurableTask");
554-
ILogger dualLogger = new DualCategoryLogger(primaryLogger, legacyLogger);
555-
556-
// Wrap the dual logger in a ReplaySafeLogger by calling the base implementation
557-
// with a temporary category, then using reflection to replace the inner logger
558-
var tempLogger = base.CreateReplaySafeLogger("temp");
559-
var loggerField = tempLogger.GetType().GetField(
560-
"logger",
561-
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
562-
loggerField?.SetValue(tempLogger, dualLogger);
563-
564-
return tempLogger;
565-
}
566-
567-
// For all other categories, use the default behavior
568-
return base.CreateReplaySafeLogger(categoryName);
569-
}
570544
}

src/Worker/Core/Worker.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ The worker is responsible for processing durable task work items.</PackageDescri
88
<EnableStyleCop>true</EnableStyleCop>
99
</PropertyGroup>
1010

11-
<ItemGroup>
12-
<InternalsVisibleTo Include="Microsoft.DurableTask.Worker.Grpc" Key="$(StrongNamePublicKey)" />
13-
<InternalsVisibleTo Include="Microsoft.DurableTask.Worker.Grpc.Tests" Key="$(StrongNamePublicKey)" />
14-
</ItemGroup>
15-
1611
<ItemGroup>
1712
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
1813
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" />

src/Worker/Core/Logging/DualCategoryLogger.cs renamed to src/Worker/Grpc/DualCategoryLogger.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33

44
using Microsoft.Extensions.Logging;
55

6-
namespace Microsoft.DurableTask.Worker;
6+
namespace Microsoft.DurableTask.Worker.Grpc;
77

88
/// <summary>
99
/// A logger wrapper that emits logs to both a primary (new) category and an optional legacy category.
1010
/// </summary>
1111
/// <remarks>
1212
/// This logger is used to maintain backward compatibility while transitioning to more specific logging categories.
1313
/// When legacy categories are enabled, log messages are written to both the new specific category
14-
/// (e.g., "Microsoft.DurableTask.Worker.Grpc" or "Microsoft.DurableTask.Worker.Orchestration")
15-
/// and the legacy broad category (e.g., "Microsoft.DurableTask").
14+
/// (e.g., "Microsoft.DurableTask.Worker.Grpc") and the legacy broad category (e.g., "Microsoft.DurableTask").
1615
/// </remarks>
17-
internal sealed class DualCategoryLogger : ILogger
16+
sealed class DualCategoryLogger : ILogger
1817
{
1918
readonly ILogger primaryLogger;
2019
readonly ILogger? legacyLogger;

0 commit comments

Comments
 (0)