title: Difference between ILogger, ILoggerFactory and ILogger<> with MS logging on Azure Functions 2
body: <p><strong>Update</strong></p>
  
  <p>What is the difference between ILoggerFactory and ILogger&lt;> with MS logging on Azure Functions 2, which supports Application Insights?</p>
  
  <p>Code below:</p>
  
  <pre class="lang-cs prettyprint-override"><code>    public class Functions
      {
          //other code
          private ILogger _log;
  
          public Functions(ILoggerFactory loggerFactory, ILogger&lt;Functions&gt; log)
          {
              _log = loggerFactory.CreateLogger&lt;Functions&gt;();
              _log = log;
          }
  
          [FunctionName("Token")]
          public async Task&lt;IActionResult&gt; Function1(
              [HttpTrigger()]...)
          {
                 _log.LogInformation("Function1 invoked");
          }
      }
  </code></pre>
  
  <p><strong>Update 2</strong></p>
  
  <p>ILogger:
  If ILogger is used as constructor parameter, the error below occurs. 
  It works if it is used as function parameter.</p>
  
  <p>What is the service lifetime for ILogger instance?</p>
  
  <p>Is there a plan to support it on CTOR?</p>
  
  <pre><code>[04/06/2019 10:06:12] Executed 'SampleFunction' (Failed, Id=3912a5b7-10fa-41e1-9
  0f8-fba9d2cda49b)
  [04/06/2019 10:06:12] Microsoft.Extensions.DependencyInjection.Abstractions: Una
  ble to resolve service for type 'Microsoft.Extensions.Logging.ILogger' while att
  empting to activate 'Microsoft.Azure.Functions.Samples.DependencyInjectionBasic.
  SampleFunction'.
  [04/06/2019 10:06:12] An unhandled host error has occurred.
  [04/06/2019 10:06:12] Microsoft.Extensions.DependencyInjection.Abstractions: Una
  ble to resolve service for type 'Microsoft.Extensions.Logging.ILogger' while att
  empting to activate 'Microsoft.Azure.Functions.Samples.DependencyInjectionBasic.
  SampleFunction'.
  </code></pre>