Tuesday, September 27, 2011

How to Enable MSI Logging

Windows Installer supports detailed logging as a powerful diagnostic tool. Logging can be enabled in the following four ways:

1.Command-line: If installing an MSI package from the command-line, the /L switch can be used to enable logging. For example, the following command installs Package.msi and outputs verbose logging to c:\Package.log

msiexec /i Package.msi /l*v c:\package.log

2.Windows Registry: The following registry value can be used to enable verbose logging:

Key: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer
Value Name: Logging
Type: REG_SZ
Data: voicewarmup

The resulting log is named MSI###.log (where "###" is a unique random identifier) and is placed in the system's Temp directory.

3.Group Policy: The following Group Policy setting can be used to manage logging on multiple systems:

Computer Configuration -> Administrative Templates -> Windows Components -> Windows Installer -> Logging.

4.Windows Installer API: If installing an MSI package programmatically, the MsiEnableLog function call can be used to create a log file and determine the logging level for the life of the calling process.

Although verbose logs are very useful for diagnosing Windows Installer problems, they can be very long and difficult to read without practice. A quick way to find the location of a problem in the log is to open it in a text editor (such as Notepad) and search for the phrase "Return Value 3". This entry commonly appears in logs close to the point where a critical error has occurred. The Windows Installer SDK provides a tool called WiLogUtl, which parses and annotates Windows Installer log files.

No comments: