从安装程序写入InstallLog
如何从服务安装程序写入 InstallLog?
我已经重写了类的 OnBeforeInstall
方法(该方法派生自 System.Configuration.Install.Installer
),现在我想写入安装程序日志。但我可以'没有看到任何允许我执行此操作的内容。
Console.WriteLine 将写入控制台但不写入日志。
How do I write to the InstallLog from a service installer?
I've overridden the OnBeforeInstall
method of my class (which derives from System.Configuration.Install.Installer
and now I want to write to the installer log. But I can't see anything that would allow me to do this.
Console.WriteLine will write to the console but not to the log.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,Installer 类中有一个名为 Context 的属性。它的类型为InstallContext。该类型具有 LogMessage() 方法,我想这就是您所需要的。有关详细信息,请参阅本文 LogMessage() 方法。
As far as I can see, there's a property called Context in the Installer class. It has type InstallContext. That type has the method LogMessage(), which I suppose is what you need. See this article for more information about LogMessage() method.
我只是创建自己的日志。
I just create my own log.