簡體   English   中英

使用DTF InstallLogModes的事件太多

[英]Too Many Events Using DTF InstallLogModes

我目前正在使用以下標志記錄“一切”:

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

如何禁用日志中那些極其冗長的消息? 我需要保留進度事件。

如果您不想要它們,請不要在API調用中設置bts。 只需設定進度即可。 但是,您確實需要掌握錯誤消息和警告才能顯示它們。

但是...您的目標是什么? 您無需重新發明可以以其他方式獲得的日志記錄。 使用該外部UI調用API的目的是現在由您負責安裝的所有UI。 這實際上與日志無關,而是由您負責UI,標准安裝通常會以一種或另一種形式顯示所有這些消息。 例如,連同進度消息一起,您將獲得說明正在發生的事情的操作消息(正在復制文件名等)。 如果那是您要安裝的實際產品,那么您確實需要顯示錯誤消息,使用中的文件對話框,警告,或者您只是隱藏所有發生的事情。

鏈接到基礎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