Microsoft.Extensions.Logging.AzureAppServices not sending logs to Blob Storage
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
I am trying to save application logs in Azure Blob Storage using Microsoft.Extensions.Logging.AzureAppServices with ILogger interface. The code to configure the provider in Program.cs is this:
```
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddAzureWebAppDiagnostics();
})
.ConfigureServices(serviceCollection =>
{
serviceCollection
.Configure(options =>
{
options.BlobName = "test.txt";
});
})
.ConfigureAppConfiguration((context, builder) =>
{
if (context.HostingEnvironment.IsDevelopment())
builder.AddUserSecrets();
})
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup();
});
```
and, the code that logs:
```
[HttpGet]
public async Task GetActiveTabloids()
{
_logger.LogTrace("{0} - Executando consulta de tabloides", DateTime.Now);
_logger.LogDebug("{0} - Executando consulta de tabloides", DateTime.Now);
_logger.LogInformation("{0} - Executando consulta de tabloides", DateTime.Now);
_logger.LogError("{0} - Executando consulta de tabloides", DateTime.Now);
_logger.LogCritical("{0} - Executando consulta de tabloides", DateTime.Now);
var availableTabloids = await _getActiveTabloidsQuery.Execute();
return Ok(new
{
tabloids = availableTabloids
});
}
```
I'm using .net core 3.1 with Microsoft.Extensions.Logging.AzureAppServices 5.0.0. After few attempts, I downgraded the package to 3.1.10, and 3.1.4, but nothing works.
The app service logs is configured on Azure to log just in blob. When set to logging in Filesystem, the logs are streamed correctly.

The problem is that the logs is not send to the configured Blob storage.
This is the container after a request made to the endpoint show above:

I noted that the ASP.NET Core Logging Integration installed in the app service is 5.0.0, but not found a way to downgrade this extension.

Can anyone help on how to fix this?
Contributor guide
Assessment
This issue has not been assessed yet.