@@ -151,6 +151,20 @@ public DataConverter DataConverter
151151 [ Obsolete ( "Experimental" ) ]
152152 public IOrchestrationFilter ? OrchestrationFilter { get ; set ; }
153153
154+ /// <summary>
155+ /// Gets options for the Durable Task worker logging.
156+ /// </summary>
157+ /// <remarks>
158+ /// <para>
159+ /// Logging options control how logging categories are assigned to different components of the worker.
160+ /// Starting from a future version, more specific logging categories will be used for better log filtering.
161+ /// </para><para>
162+ /// To maintain backward compatibility, legacy logging categories are emitted by default alongside the new
163+ /// categories. This can be disabled by setting <see cref="LoggingOptions.UseLegacyCategories" /> to false.
164+ /// </para>
165+ /// </remarks>
166+ public LoggingOptions Logging { get ; } = new ( ) ;
167+
154168 /// <summary>
155169 /// Gets a value indicating whether <see cref="DataConverter" /> was explicitly set or not.
156170 /// </summary>
@@ -177,6 +191,7 @@ internal void ApplyTo(DurableTaskWorkerOptions other)
177191 other . EnableEntitySupport = this . EnableEntitySupport ;
178192 other . Versioning = this . Versioning ;
179193 other . OrchestrationFilter = this . OrchestrationFilter ;
194+ other . Logging . UseLegacyCategories = this . Logging . UseLegacyCategories ;
180195 }
181196 }
182197
@@ -229,4 +244,51 @@ public class VersioningOptions
229244 /// </remarks>
230245 public VersionFailureStrategy FailureStrategy { get ; set ; } = VersionFailureStrategy . Reject ;
231246 }
247+
248+ /// <summary>
249+ /// Options for the Durable Task worker logging.
250+ /// </summary>
251+ /// <remarks>
252+ /// <para>
253+ /// These options control how logging categories are assigned to different components of the worker.
254+ /// Starting from a future version, more specific logging categories will be used for better log filtering:
255+ /// <list type="bullet">
256+ /// <item><description><c>Microsoft.DurableTask.Worker.Grpc</c> for gRPC worker logs (previously <c>Microsoft.DurableTask</c>)</description></item>
257+ /// <item><description><c>Microsoft.DurableTask.Worker.*</c> for worker-specific logs</description></item>
258+ /// </list>
259+ /// </para><para>
260+ /// To maintain backward compatibility, legacy logging categories are emitted by default alongside the new
261+ /// categories until a future major release. This ensures existing log filters continue to work.
262+ /// </para><para>
263+ /// <b>Migration Path:</b>
264+ /// <list type="number">
265+ /// <item><description>Update your log filters to use the new, more specific categories</description></item>
266+ /// <item><description>Test your application to ensure logs are captured correctly</description></item>
267+ /// <item><description>Once confident, set <see cref="UseLegacyCategories" /> to <c>false</c> to disable legacy category emission</description></item>
268+ /// </list>
269+ /// </para>
270+ /// </remarks>
271+ public class LoggingOptions
272+ {
273+ /// <summary>
274+ /// Gets or sets a value indicating whether to emit logs using legacy logging categories in addition to new categories.
275+ /// </summary>
276+ /// <remarks>
277+ /// <para>
278+ /// When <c>true</c> (default), logs are emitted to both the new specific categories (e.g., <c>Microsoft.DurableTask.Worker.Grpc</c>)
279+ /// and the legacy broad categories (e.g., <c>Microsoft.DurableTask</c>). This ensures backward compatibility with existing
280+ /// log filters and queries.
281+ /// </para><para>
282+ /// When <c>false</c>, logs are only emitted to the new specific categories, which provides better log organization
283+ /// and filtering capabilities.
284+ /// </para><para>
285+ /// <b>Default:</b> <c>true</c> (legacy categories are enabled for backward compatibility)
286+ /// </para><para>
287+ /// <b>Breaking Change Warning:</b> Setting this to <c>false</c> is a breaking change if you have existing log filters,
288+ /// queries, or monitoring rules that depend on the legacy category names. Ensure you update those before disabling
289+ /// legacy categories.
290+ /// </para>
291+ /// </remarks>
292+ public bool UseLegacyCategories { get ; set ; } = true ;
293+ }
232294}
0 commit comments