我有.NET 5 Web应用程序,它应该使用Serilog Sink(Serilog.Sinks.Datadog.Logs v0.5.2)将日志写入DataDog。下面是我的Program.cs:
static async Task Main(string[] args)
{
using (var log = new LoggerConfiguration()
.MinimumLevel.Verbose()
.WriteTo.DatadogLogs("HERE IS MY API KEY", service: "myservice", configuration: new DatadogConfiguration() { Url = "https://http-intake.logs.us3.datadoghq.com" })
.CreateLogger())
{
log.Debug("debug");
log.Information("information");
log.Verbose("verbose");
log.Warning("warning");
log.Error("error");
log.Fatal("fatal");
}
using IHost host = CreateHostBuilder(args).Build();
await host.RunAsync();
}
运行应用程序后,我可以在DataDog中看到所有这些日志,除了信息日志。所以,我只看到5条消息而不是6条。我做错了什么?
1条答案
按热度按时间l7wslrjt1#
我认为问题在于您设置的是Serilog日志事件级别,而不是Datadog级别。试试这个: