gpt4 book ai didi

c# - Log4Net 和奥尔良

转载 作者:太空狗 更新时间:2023-10-29 21:12:37 24 4
gpt4 key购买 nike

我想知道在 Microsoft Orleans 中使用 log4net 的最佳实践是什么?应该在哪里初始化?

最佳答案

我认为初始化每个筒仓静态变量的最佳位置是 Silo Bootstrap .

请注意,Orleans 配置了一个记录器,您可以通过调用 this.GetLogger() 获取它。

可以定义一个继承自 ILogConsumer 的记录器并通过调用将其添加到日志接收器的集合中 Orleans.Runtime.TraceLogger.LogConsumers.Add()

<编辑 2015-07-16>:这出现在 Orleans Gitter channel再次,following advice由核心团队成员提供:

we publish to .NET Trace and you can ad new listeners to it.that is actual the best way to do it, even without touching Orleans.Runtime.TraceLogger.LogConsumers.just work with .NET TRace, with usual tools and config. unrelated to Orleans. we just publish into Trace.

在另一篇 Stackoverflow 帖子中添加了一个注意事项 Logging best practices , 其中Sly Gryphon相当详尽地遍历跟踪基础设施。

关于c# - Log4Net 和奥尔良,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28700767/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com