title: How to configure Azure App Service logging provider for an ASP.NET Core app?
body: <p>I'm trying to configure custom logging in my ASP.NET Core MVC app. The app is hosted on Azure App Service on Linux (free tier). The log files are not appearing, what am I doing wrong?</p>
  
  <p>My configuration:</p>
  
  <p>Following ASP.NET Core logging documentation (<a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-3.1#azure-app-service-provider" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-3.1#azure-app-service-provider</a>), I've added an Azure App Service logging provider to my app:</p>
  
  <pre><code>public static IHostBuilder CreateHostBuilder(string[] args) =&gt;
              Host.CreateDefaultBuilder(args)
                  .ConfigureLogging(logging =&gt;
                  {
                      logging.ClearProviders();
                      logging.AddAzureWebAppDiagnostics();
                  })
                  .ConfigureServices(serviceCollection =&gt; serviceCollection
                      .Configure&lt;AzureFileLoggerOptions&gt;(options =&gt;
                      {
                          options.FileName = "azure-diagnostics-";
                          options.FileSizeLimit = 10 * 1024;
                          options.RetainedFileCountLimit = 5;
                      })
                  )
                  .ConfigureWebHostDefaults(webBuilder =&gt;
                  {
                      webBuilder.UseUrls("http://*:8080");
                      webBuilder.UseStartup&lt;Startup&gt;();
                  });
  </code></pre>
  
  <p>The logging configuration in app.settings:</p>
  
  <pre><code>{
    "Logging": {
      "LogLevel": {
        "Default": "Information",
        "Microsoft": "Warning",
        "Microsoft.Hosting.Lifetime": "Information"
      }
    },
    "AllowedHosts": "*"
  }
  </code></pre>
  
  <p>I'm logging an info, warning and an error in my controller.</p>
  
  <p>Following the Azure documentation (<a href="https://docs.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs#enable-application-logging-linuxcontainer" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs#enable-application-logging-linuxcontainer</a>), I've enabled logging to file system at Azure App -> App Service Logs:</p>
  
  <p><a href="https://i.stack.imgur.com/O0W8r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O0W8r.png" alt="Azure config"></a></p>
  
  <p>My app gets deployed fine and works. I'm expecting to find a log file with names 'azure-diagnostics' somewhere in the file system of the app. I've checked the file system by going to Azure App -> SSH and running:</p>
  
  <pre><code>find . -name '*azure-diagnostics*'
  </code></pre>
  
  <p>which doesn't return anything. I've also checked the file system using Kudu and VS Cloud Explorer, the files are not there. If I add the console logging provider, the logs appear in the standard Azure log files just fine. What am I missing here?</p>