仅当它们是任何日志时,才使用Serilog创建日志文件

发布于 2025-01-28 19:33:54 字数 175 浏览 5 评论 0原文

我想通过API请求使用Serilog在不同的日志文件上编写不同的日志。 问题是当在loggerConfiguration()中配置的日志文件时,它们都会创建任何日志。 问题在于我每个请求都有许多空日志文件。 也许Serilog有能力如果文件没有登录来写入该文件,则无法创建文件?还是解决此问题的其他解决方案?

I want to write different logs on different log files with Serilog by API request.
The problem is when the log file configured within LoggerConfiguration(), they created no matter if their is any logs or not.
The problem is that I have many empty log files per request.
Maybe Serilog has the ability not to create file if it has no logs to write to that file? or maybe any other solution for this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文