title: Create ILogger instance in Startup
body: <p>I am working on Azure Function App .net core 3.1 with Polly retry and circuit breaker. till now I dont have problem with the logging the details to App Insights using the builder because it doesnt get initialized until the execution like below</p>
  
  <pre><code>    private static void AddPoliciesAsync(this IHttpClientBuilder builder)
      {
          builder.AddPolicyHandler((service, request) =&gt;
          GetRetryAsyncPolicy(service.GetService&lt;ILogger&lt;HTTPTrigger1&gt;&gt;()).WrapAsync(
          GetCircuitBreakerAsyncPolicy(service.GetService&lt;ILogger&lt;HTTPTrigger1&gt;&gt;())));
      }
  </code></pre>
  
  <p>Where HTTPTrigger1 is the function app name for testing. Now I need to extend the existing functionality to check whether the circuit is broken or not so that I can run another set of business functionalities. For that as mentioned here <a href="https://github.com/App-vNext/Polly#circuit-breaker" rel="nofollow noreferrer">https://github.com/App-vNext/Polly#circuit-breaker</a>, I have added the singleton instance of the CB to make sure am reading the circuit breaker state.</p>
  
  <pre><code>        var logger = services.BuildServiceProvider().GetService&lt;ILogger&lt;HTTPTrigger1&gt;&gt;();
          var circuitBreaker = GetCircuitBreakerAsyncPolicy(logger);
          services.AddSingleton(circuitBreaker as ICircuitBreakerPolicy&lt;HttpResponseMessage&gt;);
          services.AddHttpClient("name", client =&gt;
          {
              // something
          })
          .AddPollyPolicies(logger, circuitBreaker);
  </code></pre>
  
  <p>But am getting the error while getting the logger instance on the second implementation. As I checked in the MS docs <a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-dependency-injection#caveats" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-dependency-injection#caveats</a> says dont log the message during the start up, eventhough am creating the instance, it still throws the error(which interns required for the subsequesnt calls). Is there anyway I can achieve the logging here?</p>