app.config 中跟踪源的最大数量
app.config 的跟踪源以及定义的侦听器是否有最大数量?
Is there a maximum number of trace sources for app.config, and by definition listeners as well?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没有记录的。这与几乎所有 .NET 框架类一致,没有硬编码限制。您最终将耗尽系统资源,通常是内存或页面文件。或者说用户的耐心。
Not a documented one. Which is consistent with almost all .NET framework classes, there are no hard-coded limits. You'll eventually run out of a system resource, usually memory or paging file. Or user patience.
我不认为 20 个一定太多 - 这取决于应用程序的大小。将它们视为虚拟日志文件,您可以独立控制其输出。如果您希望能够调高某些日志记录的数量,而不需要在生产中获得大量额外的日志记录,那么拥有单独的跟踪源(带有关联的源开关)就是实现这一目标的方法。我的经验法则是每个主要组件都有一个。拥有 20 个的一个问题是你是否有足够的纪律来正确使用它们,或者你最终是否会只使用几个。
I wouldn't say 20 is necessarily too many - it depends on the size of the application. Think of these as virtual log files, for which you can independently control the output. If you want the ability to turn up the volume on some logging without getting a lot of additional logging in production, having separate trace sources (with the associated source switches) is the way to do that. My rule of thumb is having one per major component. The one issue with having 20 is whether you'll be disciplined enough to correctly use them or whether you'll end up using just a few.