title: ILogger injected via constructor for Http trigger functions with Azure Function 2.x
body: <p><code>ILogger</code> can be injected to function parameter, like <code>Token</code> method below.</p>
  
  <p>However, the error below occurred when it is injected to constructor parameter <code>log</code>.</p>
  
  <blockquote>
    <p>[07/03/2019 17:15:17] Executed 'Token' (Failed,
    Id=4e22b21f-97f0-4ab4-8f51-8651b 09aedc8) [07/03/2019 17:15:17]
    Microsoft.Extensions.DependencyInjection.Abstractions: Una ble to
    resolve service for type 'Microsoft.Extensions.Logging.ILogger' while
    attempting to activate 'Functions'.</p>
  </blockquote>
  
  <p><code>ILogger</code> can be injected to <code>Token</code> function parameter below. But the error above occurred when it is injected to constructor parameter <code>log</code>.</p>
  
  <pre><code>public class Functions
  {
      private HttpClient _httpClient;
      private IAppSettings _appSettings;
      private ILogger _log;
  
      public Functions(HttpClient httpClient, IAppSettings appSettings  //working for these two
        , ILogger log  //not working, errors
      )
      {
  
          _log = log;
      }
  
      [FunctionName("Token")]
      public async Task&lt;IActionResult&gt; Token(
          [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "Token")]
          HttpRequest httpRequest,
          ILogger log)
      {
  
      }
  }
  </code></pre>
  
  <p>Dependence injection below</p>
  
  <pre><code>[assembly: WebJobsStartup(typeof(Startup))]
  namespace MyApp
  {
      public class Startup : IWebJobsStartup
      {
          public void Configure(IWebJobsBuilder builder)
          {
              builder.Services.AddHttpClient();
              builder.Services.AddTransient&lt;IAppSettings, AppSettings&gt;();     
               //builder.Services.AddLogging();  //not working
             //builder.Services.AddSingleton&lt;ILogger&gt;() //not working
          }
  }
  </code></pre>
  
  <p>Visual studio 2017 </p>