与log4net ThreadContext.Properties类似

huangapple go评论64阅读模式
英文:

Analogue to log4net ThreadContext.Properties

问题

Log4net有一个ThreadContext类,其中有一个Properties属性。我们在.NET(ASP.NET Core)中需要类似的功能,使用Serilog或其他技术。

我们需要在.NET(ASP.NET Core)中实现类似于log4net ThreadContext.Properties功能的功能。

英文:

Log4net has a ThreadContext class that has a Properties property. We need an analogue of this functionality with Serilog or other technology in .NET (ASP.NET Core)

We need an analague of the log4net ThreadContext.Properties functionality in .NET (ASP.NET Core)

答案1

得分: 2

在Serilog中,我们有LogContext类,它类似于Log4net中的ThreadContext。两者都具有用于存储上下文信息的Properties属性(字典)。

您可以在此处查看文档 - https://github.com/serilog/serilog/wiki/Enrichment

如果这有帮助,请告诉我!

英文:

In Serilog, we have LogContext class which is analogous to ThreadContext from Log4net. Both have the property Properties (dictionary) to store the contextual information.

You can checkout the documentation here - https://github.com/serilog/serilog/wiki/Enrichment

Do let me know if this was helpful!

huangapple
  • 本文由 发表于 2023年2月27日 18:06:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/75579070.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定