Visual Studio C# 自定义操作的日志记录服务

发布于 2024-10-06 08:57:57 字数 208 浏览 3 评论 0原文

为了帮助隔离用户尝试使用我的安装程序时可能出现的问题,我决定通过自定义操作在日志文件中记录安装进度、状态、错误和警告。然而,流行的日志记录包似乎都不可行,因为它们需要配置调用程序集(例如 log4net)。我还了解到,在尝试失败后,您无法通过安装程序类进行 MSI 日志记录。现在我可以简单地诉诸基本的文件操作来记录信息。这是大多数使用日志编写自定义操作的人所做的事情,还是有另一种我没有考虑过的方法?

To help isolate problems that may occur when users try to use my installer, I have decided to log installation progress, states, errors, and warnings in a log file from my custom actions. However, none of the popular logging packages seem to be viable since they require configuration of the calling assembly (log4net for example). And I have also read that you cannot do MSI logging through Installer classes after trying and failing. For now I can simply resort to basic file operations to log the information. Is this what most people do who write custom actions with logs, or is there a another way I have not considered?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

[旋木] 2024-10-13 08:57:57

我自己喜欢 Windows 事件日志。

System.Diagnostics.EventLog

I like the Windows Event Log myself.

System.Diagnostics.EventLog

调妓 2024-10-13 08:57:57

最后,我的安装程序最终需要一个外部 ui 处理程序。这导致我从设置和设置切换到部署到 wix/votive 以满足我的 MSI 需求。因此,DTF 自定义操作能够使用 MSI 日志记录。

In the end, my installer ended up needing an external ui handler. This caused me to switch from setup & deployment to wix/votive for my MSI needs. As a result the DTF custom actions were able to use MSI logging.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文