简体   繁体   English

使用DTF InstallLogModes的事件太多

[英]Too Many Events Using DTF InstallLogModes

I'm currently logging "everything" using the following flags: 我目前正在使用以下标志记录“一切”:

const DTF.InstallLogModes logEverything = DTF.InstallLogModes.FatalExit |
                                                      DTF.InstallLogModes.Error |
                                                      DTF.InstallLogModes.Warning |
                                                      DTF.InstallLogModes.User |
                                                      DTF.InstallLogModes.Info |
                                                      DTF.InstallLogModes.ResolveSource |
                                                      DTF.InstallLogModes.OutOfDiskSpace |
                                                      DTF.InstallLogModes.ActionStart |
                                                      DTF.InstallLogModes.ActionData |
                                                      DTF.InstallLogModes.CommonData |
                                                      DTF.InstallLogModes.Progress |
                                                      DTF.InstallLogModes.Initialize |
                                                      DTF.InstallLogModes.Terminate |
                                                      DTF.InstallLogModes.ShowDialog;

DTF.Installer.SetInternalUI(DTF.InstallUIOptions.Silent);
var handler = new DTF.ExternalUIRecordHandler(ProcessMessage);
DTF.Installer.SetExternalUI(handler, logEverything);
DTF.Installer.EnableLog(logEverything, logPath, true, true);
DTF.Installer.InstallProduct(installerPath, commandLine);

This has the effect of writing an enormous number of events to the log file. 这具有将大量事件写入日志文件的效果。

For example, I'm seeing thousands of these: 例如,我看到成千上万的这样的东西:

MSI (s) (14:A0) [11:33:50:764]: Component: comp_27E5179987044690962CE98B3F95FD72; Installed: Local;   Request: Null;   Action: Null;   Client State: Local
MSI (c) (4C:8C) [11:34:17:869]: Creating MSIHANDLE (592) of type 790531 for thread 8076
MSI (c) (4C:8C) [11:34:17:893]: Closing MSIHANDLE (592) of type 790531 for thread 8076

How do I disable those extremely verbose messages in the log? 如何禁用日志中那些极其冗长的消息? I need to keep the Progress events. 我需要保留进度事件。

If you don't want them, don't set the bts in the API call. 如果您不想要它们,请不要在API调用中设置bts。 Just set progress. 只需设定进度即可。 However, you do need to get hold of the error messages and warnings to display them. 但是,您确实需要掌握错误消息和警告才能显示它们。

However....what's your goal here? 但是...您的目标是什么? You don't need to re-invent the logging that you can get in other ways. 您无需重新发明可以以其他方式获得的日志记录。 The purpose of using that external UI call API is that you are now in charge of all the UI for the install. 使用该外部UI调用API的目的是现在由您负责安装的所有UI。 This isn't really about logging, it's about you being responsible for the UI, and a standard install will typically show all those messages in one form or another. 这实际上与日志无关,而是由您负责UI,标准安装通常会以一种或另一种形式显示所有这些消息。 For example, along with progress messages you get action messages that says what's going on (file name being copied, etc). 例如,连同进度消息一起,您将获得说明正在发生的事情的操作消息(正在复制文件名等)。 If that is an actual product that you are installing, then you really need to show error messages, files in use dialogs, warnings, or you're simply hiding everything that goes on. 如果那是您要安装的实际产品,那么您确实需要显示错误消息,使用中的文件对话框,警告,或者您只是隐藏所有发生的事情。

Link to underlying AP docs: https://msdn.microsoft.com/en-us/library/aa370573(v=vs.85).aspx 链接到基础AP文档: https : //msdn.microsoft.com/zh-cn/library/aa370573(v= vs.85) .aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM