为 MSI 安装程序启用安装日志,无需任何命令行参数 [英] Enable installation logs for MSI installer without any command line arguments
问题描述
如何在我的 MSI 项目 中启用 logging 并设置 MsiLogFileLocation
?现在我正在使用命令行参数运行我的 setup.msi
:
msiexec/i install.msi/l*v InstallLog.log
我想记录我的工作总是只运行 setup.msi
而没有任何参数.有没有办法做到这一点?
来自 MSI SDK:"您可以使用 命令行选项,MsiLogging属性、日志记录政策、MsiEnableLog,和EnableLog 方法".
简短回答:所以添加属性 MsiLogging 属性到您的 MSI 的 属性表 并且可能使用
"vp"
作为值(不带引号).
<块引用>
调试热点:搜索"value 3" 以查找错误,如 Rob Mensching
(Wix & Orca 作者).否则 MSI 日志文件可能会让人不知所措.请参阅下面有关日志解释的更多信息(黄色部分).
Burn:WiX Burn Bundles(setup.exe
启动器)有自己的日志结构(除了MSI 特定的日志记录).换句话说,MSI 文件有它们的日志记录,而 setup.exe
刻录启动器有它们的日志记录.
快速日志记录(详细):来自 cmd.exe
的最简单的详细日志记录.
msiexec.exe/i C:\Path\Your.msi/L*v C:\Your.log
参数快速说明:
/i = 运行安装序列/L*v C:\Your.log = 指定路径的详细日志记录
调试日志记录(详细):高级、缓慢的日志记录以捕获最大的细节.
msiexec.exe/i C:\Path\Your.msi/L*vx!C:\你的.log
参数快速说明:
/i = 运行安装序列/L*vx!C:\Your.log = 指定路径的详细调试日志记录x 添加额外的调试信息,而 !禁用日志缓冲区.这意味着如果发生任何崩溃,则不会丢失日志.
所有 MSI 包 - 全局日志记录(政策)
是的,您通过设置适当的注册表项在机器上全局启用日志记录
.然后,每个 MSI 启动都会在 TEMP
文件夹中创建一个带有临时名称的日志文件.按更改日期对文件列表进行排序以获得最新的.
注册码 &值:实际的注册表设置:
[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer]记录"=语音预热";调试"=dword:00000007
操作方法:请参阅 installsite.org 中的此常见问题解答条目,全局适用于机器上的所有设置代码>
":http://www.installsite.org/pages/en/msifaq/a/1022.htm 了解具体程序.
Heads-Up(技术细节):这是一个非常技术性的问题,可能会产生令人烦恼且非常意想不到的实用效果
.此全局日志记录的副作用是任何 会话对象 您使用 MSI- 从脚本实例化API 还将在 TEMP 文件夹中创建一个日志文件.如果您迭代所有包并实例化会话对象,这可能会导致在 TEMP 文件夹中创建数百个日志文件.也在事件日志中(大系统管理员不行!).非常具体的问题,但只是指出它.清理临时文件夹和事件日志解决"问题 - 或者更好 - 只是避免创建 Session 对象.请注意,您的部署工具可能会意外地实例化会话对象.也许在启用日志记录后检查,这样你就不会在网络范围内遇到这个愚蠢的问题.
特定于包的日志记录
除了全局设置和策略之外,您还可以通过属性或自定义操作自定义每个包的日志记录,或者仅通过 msiexec.exe 命令行指定选项和日志记录位置.
命令行:最简单的形式:msiexec.exe/i C:\Path\Your.msi/L*v C:\Your.记录
.msiexec.exe 命令行 的文档(查看开关部分:/L
)
属性:您可以设置MsiLogging 属性 在每个包中自定义日志记录.MSI 属性 MsiLogFileLocation 包含日志文件的路径.如果您想在安装后打开日志,请使用此选项.
自定义操作:您可以调查 MSI-API 从自定义操作自定义特定 MSI 的日志记录行为.更多:Windows Installer 日志记录.>
解释 MSI 日志文件
<块引用>关于解释日志文件的话题:如何解释 MSI 日志文件.
直接链接:指向 Robert Macdonald 日志指南的直接 PDF 链接
(从 Wayback 复活).>
查找错误:并且,如上所述:搜索 "value 3" 在日志文件中查找Rob Mensching
(Wix &逆戟鲸作者).否则 MSI 日志文件可能会不堪重负.
高级安装程序:如何读取 Windows Installer 详细日志文件?
写入日志:从您自己的自定义操作写入 MSI 日志文件并不难.以下是 Robert Dickau 关于该主题的入门指南:MSI 提示:从自定义操作写入日志文件.
一些链接:
- Windows 安装程序日志记录(很多核心信息,请阅读)
- Windows Installer 最佳实践(用于故障排除的详细日志记录)
- MSI 安装日志说:注意:1:2205 2:3:错误
- 在- 使用未由 MSI 安装程序更新的文件(Visual Studio 安装程序项目)
- 如何阅读 Windows Installer 详细日志文件?
- 如何重现 MSI 安装错误
- 如何阅读 Windows 安装程序详细日志
How can I enable logging in my MSI project and set MsiLogFileLocation
? Now I am running my setup.msi
with command line arguments:
msiexec /i install.msi /l*v InstallLog.log
I want to log my work always just running setup.msi
without any arguments. Are there any ways to do that?
From the MSI SDK: "You can enable verbose logging on the user's computer by using Command Line Options, the MsiLogging property, Logging policy, MsiEnableLog, and EnableLog method".
Short Answer: So add the property MsiLogging property to your MSI's Property Table and maybe use
"vp"
as value (without the quotes).
Hot Debugging Tip: Search for "value 3" in the log file to find errors as explained by
Rob Mensching
(Wix & Orca author). MSI log files can be overwhelming otherwise. See more on log-interpretation below (yellow section).
Burn: WiX Burn Bundles (setup.exe
launchers) have their own logging constructs (beyond the MSI-specific logging described above). In other words MSI files have their logging, and setup.exe
burn launchers have theirs.
- See this answer, and from Rob Mensching himself (WiX benevolency).
- https://support.firegiant.com/hc/en-us/articles/230912407
Express Logging (Verbose): Simplest possible, verbose logging from cmd.exe
.
msiexec.exe /i C:\Path\Your.msi /L*v C:\Your.log
Quick Parameter Explanation:
/i = run install sequence
/L*v C:\Your.log = verbose logging at specified path
Debug Logging (Verbose): Advanced, slow logging for maximum details captured.
msiexec.exe /i C:\Path\Your.msi /L*vx! C:\Your.log
Quick Parameter Explanation:
/i = run install sequence
/L*vx! C:\Your.log = verbose debug logging at specified path
The x adds extra debugging information, and the ! disables the log buffer.
This means there is no lost log if there are any crashes.
All MSI Packages - Global Logging (policy)
Yes, you enable logging globally on the machine
by setting the appropriate registry key. Each MSI launched will then cause a log file with a temporary name to be created in the TEMP
folder. Sort file list by change date to get the most recent one.
Registry Key & Value: The actual registry settings:
[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer]
"Logging"="voicewarmup"
"Debug"=dword:00000007
How-To: Please see this FAQ-entry from installsite.org, section "Globally for all setups on a machine
": http://www.installsite.org/pages/en/msifaq/a/1022.htm for the exact procedure.
Heads-Up (technical detail): This is a very technical problem that may have a bothersome and highly unexpected pragmatic effect
. A side-effect of this global logging is that any Session objects you instantiate from a script using the MSI-API will also create a log file in the TEMP folder. This can cause hundreds of log files to be created in the TEMP folder if you iterate all packages and instantiate a session object. Also in the Event Log (a big system administrator no-no!). Very specific problem, but just pointing it out. A cleanup of the temp folder and Event Log "solves" the problem - or better yet - just avoid creation Session objects. Note that your deployment tool could instantiate session objects unexpectedly. Maybe check after enabling logging so you don't get this silly problem network-wide.
Package-Specific Logging
Apart from global settings and policies, you can customize the logging per package via properties or custom actions or just specify options and logging location via the msiexec.exe command line.
Command Line: In its simplest form: msiexec.exe /i C:\Path\Your.msi /L*v C:\Your.log
. Documentation for the msiexec.exe command line (look at section for switch: /L
)
Properties: You can set the MsiLogging property in each package to customize logging. The MSI property MsiLogFileLocation holds the path to the log file. Use this if you want to open the log after installation.
Custom Action: You could investigate the Installer.EnableLog method
of the MSI-API to customize the logging behavior for a specific MSI from a custom action. More: Windows Installer Logging.
Interpreting MSI Log Files
On the topic of interpreting log files: How to interpret an MSI Log File.
Direct Link:
Direct PDF Link to Robert Macdonald's log guide
(resurrected from Wayback).Find Errors: And, as stated above: search for "value 3" in the log file to find errors as explained by
Rob Mensching
(Wix & Orca author). MSI log files can be overwhelming otherwise.Advanced Installer: How Do I Read a Windows Installer Verbose Log File?
Writing to Log: Writing to the MSI log file from your own custom actions is not that hard. Here is a primer on the subject from Robert Dickau: MSI Tip: Writing to the Log File from a Custom Action.
Some Links:
- Windows Installer Logging (lots of core information, do read)
- Windows Installer Best Practice (verbose logging for troubleshooting)
- MSI installation log says: Note: 1: 2205 2: 3: Error
- In-use files not updated by MSI-installer (Visual Studio Installer project)
- How Do I Read a Windows Installer Verbose Log File?
- How to Reproduce MSI Install Error
- How To Read A Windows Installer Verbose Log
这篇关于为 MSI 安装程序启用安装日志,无需任何命令行参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!