Only custom events are getting logged twice with serilog

325 Views Asked by At

I have a custom logger which implements serilog. Trace are getting logged once but the events are getting logged twice.

Below is the host.json:

{
"version": "2.0",
"logging": {
    "applicationInsights": {
        "samplingSettings": {
            "isEnabled": true,
            "excludedTypes": "Request"
        }
    }
}

}

Appsettings:

    {
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "APPINSIGHTS_INSTRUMENTATIONKEY": "abcdef-ghi-49f9-bd20-xxxxxxxxxxx"
  }
}

EventLogger is created as below:

EventLogger = new LoggerConfiguration()
             .ReadFrom.AppSettings()
             .Enrich.FromLogContext()
             .WriteTo
             .ApplicationInsights(this.TelemetryConfiguration.InstrumentationKey, TelemetryConverter.Events).CreateLogger();

The problem is just with custom events.Any thoughts on why this can happen?

enter image description here

0

There are 0 best solutions below