[英]Serilog logging to Azure eventhub stopped working after moving project to .Net Core 5
I have a .Net Core 3.1 project that uses Serilog and posts messages to Azure Eventhub.我有一个使用 Serilog 并将消息发布到 Azure Eventhub 的 .Net Core 3.1 项目。 The problems started when we moved it to .Net 5.
当我们将其移至 .Net 5 时,问题就开始了。
Here's how it's configured in Startup.cs in ConfigureServices we have section这是我们在 ConfigureServices 部分的 Startup.cs 中的配置方式
var eventHubConfig = Configuration.GetSection("Logging").GetSection("eventHub");
string eventHubConnection = eventHubConfig.GetValue<string>("connectionString");
Log.Logger = new LoggerConfiguration()
.WriteTo.AzureEventHub(new JsonFormatter(),
eventHubConnection.Replace(@"\", ""),
eventHubConfig.GetValue<string>("entityName"))
.CreateLogger();
in Configure method we have: loggerFactory.AddSerilog();
在配置方法中,我们有:
loggerFactory.AddSerilog();
and in Program.cs在 Program.cs 中
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseSerilog()
.UseStartup<Startup>();
Very simple and it's working for .Net Core 3.1, but once I change the target framework for the project to .Net 5 it stops working.非常简单,它适用于 .Net Core 3.1,但是一旦我将项目的目标框架更改为 .Net 5,它就会停止工作。
Any thoughts?有什么想法吗? Has anyone seen the same issue?
有没有人看到同样的问题?
Serilog uses an old version of Microsoft.Azure.EventHubs internally Serilog 在内部使用旧版本的 Microsoft.Azure.EventHubs
I had the same issue and bumping to 4.3.2 solved the problem我有同样的问题,碰到4.3.2解决了这个问题
Since then Microsoft.Azure.EventHubs have been deprecated and we have moved to Serilog 6 and Azure.Messaging.EventHubs从那时起,Microsoft.Azure.EventHubs 已被弃用,我们已移至 Serilog 6 和 Azure.Messaging.EventHubs
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.