我目前正在使用以下标志记录“一切”:
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);这会将大量事件写入日志文件。
例如,我看到了成千上万的这样的东西:
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如何禁用日志中那些非常冗长的消息?我需要保留进度事件。
发布于 2015-04-21 18:25:03
如果不需要,就不要在API调用中设置bts。只是设定进度。但是,您确实需要掌握错误消息和警告才能显示它们。
但是.你的目标是什么?你不需要重新发明你可以用其他方式获得的日志记录。使用该外部UI调用API的目的是,您现在负责安装的所有UI。这实际上不是关于日志记录,而是关于您负责UI,标准安装通常会以某种形式显示所有这些消息。例如,除了进度消息之外,您还会得到显示正在发生的事情(文件名被复制等)的操作消息。如果这是您正在安装的实际产品,那么您确实需要显示错误消息、在使用中的文件、对话框、警告,或者只是隐藏所发生的一切。
链接到基础AP文档:https://msdn.microsoft.com/en-us/library/aa370573(v=vs.85).aspx
https://stackoverflow.com/questions/29776969
复制相似问题