0

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.

Mark Richman
  • 28,948
  • 25
  • 99
  • 159

1 Answers1

1

If you don't want them, don't set the bts in the API call. 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. 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. 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

PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • Hi Phil. Thanks for responding to my mailing list message too. What I've implemented is a silent handler which sends install progress messages over a WCF duplex channel to another machine. This app has a GUI which displays the installation progress. The only messages I need to send back over that channel are Progress and an exit code (so I can trap errors on the remote end). However, I still want the MSI log file on the local machine. All of the above work just fine, but it's super chatty, slow, and verbose. Happy to elaborate offline. https://gist.github.com/mrichman/a01acdfe98a56ff44b42 – Mark Richman Apr 22 '15 at 12:22
  • Have you considered just calling msiexec /I foo.msi /l*v! install.log and then parsing the log as lines get written to it? – Christopher Painter Apr 30 '15 at 07:17
  • If I parse the text file, I don't get the progress % as decimal values. I'm sending those values back over the duplex channel to my client app in order to bind to a progress bar. All that works well for for me now, so I didn't want to reinvent the wheel. I'm also using different log modes for the `SetExternalUI` and `EnableLog` now. `SetExternalUI` gets `Progress | FatalExit` and `EnableLog` gets `Verbose`. Everything is acceptable for now. Thanks! – Mark Richman Jun 02 '15 at 19:50