Serilog 请求记录到 Application Insights 正在记录为 Trace

Ste*_*ake 5 asp.net serilog asp.net-core

我的 Main 中有以下代码

Log.Logger = new LoggerConfiguration()
        .MinimumLevel.Debug()
        .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
        .MinimumLevel.Override("System", LogEventLevel.Warning)
        .MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning)
        .Enrich.FromLogContext()
        .WriteTo.ApplicationInsights(
        configuration["ApplicationInsights:InstrumentationKey"],
              new CustomConverter())
        .CreateLogger();
Run Code Online (Sandbox Code Playgroud)

.UseSerilog();我的CreateHostBuilder方法。

然后在我的Configure

app.UseSerilogRequestLogging();
Run Code Online (Sandbox Code Playgroud)

日志正在到达应用程序见解,但Requests被记录为Traces

我相信这是由于app.UseSerilogRequestLogging();不知道App Insights并且它只是触发了一个简单的日志,而 App Insights 不知道它是一个请求跟踪日志,因此它只是将其记录为Trace

如何将UseSerilogRequestLogginglog 生成的日志作为Requestin App Insights