Steffen Cleveland
Steffen Cleveland

Reputation: 101

Azure Application Insights traces not showing

I am trying to configure Logging for my .NET 6 Blazor server application. In the past it has not been an issue for me, but now I can not see any Traces logs on Azure. I have been followring these qusetions:

Application Insights' Logs Not Writing to Traces Log

ILogger Logging Doesn't Show Up in Azure Application Insights

Moreover I have followed the documentation here:

Application Insights logging with .NET

Application Insights for ASP.NET Core applications

Migrate from Application Insights instrumentation keys to connection strings

Sampling in Application Insights

The code

AppSettings

"Logging": {
    "LogLevel": {
      "Default": "Warning"
    },
    "ApplicationInsights": {
      "LogLevel": {
        "Default": "Warning"
      }
    }
  },

"ApplicationInsights": {
    "ConnectionString": "
InstrumentationKey=Here i put the InstrumentationKey ofc. ;IngestionEndpoint=https://northeurope2.in.applicationinsights.azure.com/
;LiveEndpoint=https://northeurope.livediagnostics.monitor.azure.com/"
  },

Program.cs

var options = new ApplicationInsightsServiceOptions { ConnectionString = configuration["ApplicationInsights:ConnectionString"] };
builder.Services.AddApplicationInsightsTelemetry(options);

The razor.cs page

    [Inject]
    public ILogger<NailOtherSingelShearTimberTimber> Logger { get; set; }

    public async Task SaveFile()
    {
        Logger.LogWarning("File saved");       
    }

If i run it locally I can see it is being sent...

enter image description here

But I get nothing on Azure no matter how long i wait.

enter image description here

And Data sampling is set to 100%

enter image description here

Does anyone know what I am doing wrong?

Upvotes: 2

Views: 4265

Answers (1)

Steffen Cleveland
Steffen Cleveland

Reputation: 101

After two days without any success I decided to delete the web app + resource group and created a new web app. Then I updated the connection string in AppSettings, published the application and now logging works like a charm.

Upvotes: 1

Related Questions