CreateReplaySafeLogger usage

suvra panda 1 Reputation point
2021-12-20T14:21:14.63+00:00

We have a code that uses the fan-out/fan -in approach of Azure Durable Functions.

The main Orchestrator Function is calling Sub Orchestrator Functions from it. We are using logging in the main Orchestrator Function as well as the Sub Orchestrator functions that get called from the main Orchestrator Function.

Do we need to use the CreateReplaySafeLogger in both Main Orchestrator Function as well as the Sub Orchestrator Functions.

public async Task<Dictionary<string, string>> RunOrchestrator([OrchestrationTrigger] IDurableOrchestrationContext context, ILogger log)
{
        var logger = context.CreateReplaySafeLogger(log); 
}

Please Suggest as to what is the correct approach

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,506 Reputation points
    2021-12-20T16:16:50.597+00:00

    @suvra panda ,

    Thanks for reaching out to Q&A.

    It is better to use CreateReplaySafeLogger method in both orchestrator and sub-orchestrator methods. We know that this method returns an instance of ILogger that is replay safe. There are chances that the sub-orchestrator will replay its activity functions so it is safe to use CreateReplaySafeLogger method to avoid duplicate logs.

    https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.webjobs.extensions.durabletask.durablecontextextensions.createreplaysafelogger?view=azure-dotnet

    I hope this helps!

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.