Logging an MSI Installation
Summary
To create a log file that records the progress of the installation, execute your MSI package from the command line using the /L parameter.
Synopsis
To create a log file that records the progress of the installation, execute your MSI package from the command line using the /L parameter. The log file can then be used to diagnose the cause of failure or unexpected behavior during the installation.
Discussion
To log the execution of an MSI package, include the /L parameter along with one or more flags or modifiers, in addition to any other command-line parameters. You must also specify a path for the log file.
The following example shows how to enable verbose logging, which captures the maximum amount of available information:
msiexec /i "C:\my stuff\package.msi" /l*v "d:\place for logs\package.log"
The following table lists the modifiers or flags, which can be used in conjunction with the /L parameter:
| Modifiers | Description |
|---|---|
| i | Status messages -Indicates when actions are started and stopped. |
| w | Non-fatal warning messages. |
| e | All error messages |
| a | Commencement of action sequences. |
| r | Action-specific records. |
| u | User requests. |
| c | Initial user interface parameters. |
| m | Out-of-memory or fatal exit messages. |
| o | Out-of-disk-space messages. |
| p | All the properties and their values at the end of the installation. |
| v | Verbose output. |
| x | Extra debugging information-only available on Windows Server 2003. |
| + | Append information to an existing file. |
| ! | Flush each line to the log. |
| * |
Wild-card character that enables you to log all information (excluding the verbose output that v provides and the extra debugging information that x provides). To include the v and x options, specify the following: /l*vx. |
Additional Examples
Here are additional examples of command lines for logging installations:
- Track the sequence of actions during uninstallation:
msiexec /x {00010001-0001-0001-0001-000100010001} /li "d:\logdir\package.log"
- Log only errors:
msiexec /i "C:\my stuff\package.msi" /le "d:\place for logs\package.log"
- Log detailed events, including out-of-memory and disk space errors:
msiexec /jm "C:\my stuff\package.msi" /lvmo "d:\place for logs\package.log"
- Append a list of all properties and their values at the end of the installation instead of overwriting the log file:
msiexec /i "C:\my stuff\package.msi" /lp+ "d:\place for logs\package.log"
Logging Through setup.exe
If you have built a single compressed setup.exe and do not have direct access to the MSI file, you can use the /v command-line parameter to pass logging parameters to MsiExec.exe. However, keep in mind that the log will only capture the execution of the MSI package-it will not track actions performed by setup.exe, instmsia.exe, or instmsiw.exe.
Pass the logging-specific switches and parameters as an argument to /v.
Important Considerations:
- No space should be present between
/vand its argument. - Enclose the entire argument in double quotes.
- Use a backslash (
\) before any quote characters within the argument.
The following example displays the use of the /v command-line parameter with setup.exe:
setup.exe /v"/l*vx \"d:\place for logs\package.log\""
Logging in Windows Installer 4.0 and Windows Vista
Windows Installer 4.0 allows MSI logging to occur on a project-wide basis without requiring command line usage or registry configuration. For more details on this option, refer to the InstallShield Help article Specifying Whether Windows Installer Installations Should Be Logged.
Logging a Silent Install
The following command lines ensure a silent installation with verbose logging:
setup.exe /s /v"/l*vx \"d:\place for logs\package.log\" /qn"
msiexec /i "C:\my stuff\package.msi" /l*v "d:\place for logs\package.log" /qn
Related KB Articles
See Logging An InstallScript MSI Project.
Additional Information
For more information on logging, see the following Microsoft articles:
- 223300: How to Enable Windows Installer Logging
- 2545723: How to Enable Microsoft Installer logging and Verbose logging to gather additional troubleshooting Information
- Command-Line Options: Command line options for msiexec.exe