英文:
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!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论