c# - Serilog Request logging is not outputting endpoint data
问题描述
I started setting up my project to use Serilog Request logging using this tutorial. I see the message that I log before calling the CreateHostBuilder()
method, but according to the article, the console should show the endpoints and HTTP requests. However, none of that is showing. I've tried both Kestrel and IIS Express. I'm not sure what's going on.
I suspect the problem has something to do with my Startup.cs file, as the app I'm working with (GrandNode) is different from the example app in the tutorial. Here is the Configure()
method from Startup.cs:
public void Configure(IApplicationBuilder application, IWebHostEnvironment webHostEnvironment)
{
application.UseSerilogRequestLogging();
application.ConfigureRequestPipeline(webHostEnvironment);
}
Here is my Main method in Program.cs:
public static void Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Console()
.WriteTo.Seq("http://localhost:5341")
.CreateLogger();
try
{
Log.Information("Starting up host 555");
CreateHostBuilder(args).Build().Run();
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly");
}
finally
{
Log.CloseAndFlush();
}
}
Any help here would be great!
解决方案
推荐阅读
- android - 为什么 tts 没有改变 Android Fragment 中的语言但在 Activity 中工作正常?
- kubernetes - Istio 从 1.4 升级到 1.5
- mysql - MySQL - GROUP_CONCAT 在连接多个表时消除重复
- javascript - 如何在单击按钮时重置 jquery-UI 滑块范围值
- kubernetes - 安装 minikube (Kubernetes) 因为我只有一个主服务器/节点,但它不是指向我的 IP,而是指向 IP 172.17.0.2
- easyadmin - 无法让 CollectionField 在 EasyAdmin 3.0 中工作
- java - 如何仅允许 JSON 发布(以及稍后获取)资源的“时间”(不是日期/时间戳)属性
- blazor - 在页面加载之前显示页面加载进度条
- qt - QMl QtControls.Slider 返回带小数点的值
- c++ - 为什么 std::getline 的返回值不能转换为 bool?