Monday, November 17, 2008

MSI Log File Basics


An MSI log file is a text file that provides a great deal of information about an installation

program during a given run on a particular system, including:

�� Final property values

�� Startup information for actions

�� Status, warning, and error messages

There are several ways to create an MSI log file, including:

1. Use the /L switch to msiexec.exe, as in this command:

msiexec /i product.msi /L*v everything.log

The characters "*v" after the /L switch indicate to perform verbose logging of every

action taken by Windows Installer. The MSI help library describes the other switches

you can use to limit the information contained in a log file.

If your release settings include creation of a setup.exe launcher, you can use the MSI

Command Line Arguments setting in the release properties to pass in the /L switch

to msiexec.exe, with a value such as this:

/L*v "%TEMP%\everything.log"

Note that you cannot use MSI properties in the log-file path, as properties will not be

available until after the installation has initialized. The command above relies on the

command processor expanding the %TEMP% environment variable.

2. With MSI 4.0 on Windows Vista, you can set the MsiLogging property to a string

containing the logging flags you want to use. With InstallShield 2008, you can set this

using the Create MSI Logs setting in the Product Properties view. The path to the log

file will be stored in the MsiLogFileLocation property. (Note that you can read this

property but not set it.) Using this switch in the InstallShield environment also

displays the Show the Windows Installer Log check box in the SetupCompleteSuccess

dialog box.

The MSI help library describes other options, such as setting the Logging policy in the

registry, which creates a randomly-named log file in the Temp directory for every MSI

installation.

The MSI Log File Analyzer, available under InstallShield's Tools menu, can generate an MSI

log file and create various color-coded HTML reports based on a log file.

By default, an MSI log file contains a return value for each built-in and custom action. The

following sections describe how to write more detailed information into the log file. Note

that these techniques do not create an MSI log file or initiate logging, but instead write to a

log file created by the /L switch, the MsiLogging property, or the like.

No comments: