Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WiX Toolset default logging file location

Tags:

wix

I have been using WiX for a few weeks now and still finding it hard to get good information about how things are supposed to work. One of those is logging. I have a requirement to have the installer write a log file to a specific location without the user having to add any /l command line parameters. I see there is a Log command, but it's parent is Bundle, the root element for creating bundled packages. I have a simple installer, so probably not needed for my case. This should be easy, right?

like image 373
Tyrel Van Niekerk Avatar asked Oct 27 '25 10:10

Tyrel Van Niekerk


2 Answers

1. This is the simplest solution (If I were you I would do this) - create a batch file which executes the following command:

   msiexec /i MyProduct.msi /L*V "%TEMP%\MyProduct.log"

Edit the path in the batch file to the custom path that you want.

2. You can make use of the MSILogging Property to set the logging outside of the command line. But this property is only available from Windows Installer 4.0.

Basically, you need to add a new property within your .wxs file:

<Property Id="MsiLogging" Value="voicewarmupx!"/>
  • v – Verbose output
  • o – Out-of-disk-space messages
  • i – Status messages
  • c – Initial UI parameters
  • e – All error messages
  • w – Non-fatal warnings
  • a – Startup of actions
  • r – Action-specific records
  • m – Out-of-memory or fatal exit information
  • u – User requests
  • p – Terminal properties
  • ! – Flush each line to the log
  • x – Extra debugging information

This will ensure that the log file will be created in the %temp% folder, the name of the log file will be something like "MSI*.LOG." The full path to the log file can be read from this property and MsiLogFileLocation. But the MsiLogFileLocation property is read only and cannot be set.

Now this doesn't satisfy your requirement to create the log file in the custom location as we are not able to set the log file location. The reason we can't set the log file location inside WIX is because we need to tell MSIEXEC where to write the log file to before the windows installer engine actually starts executing the MSI.

To fix this, one thing that you can do is to add a custom action and copy the log file from the %temp% folder to the folder that you want. It would be something like this:

<CustomAction Id="CopyLogFile" Execute="immediate" 
              ExeCommand="cmd /c copy [MsiLogFileLocation] C:\customlocation\MyProduct.log" 
              Directory="TARGETDIR" 
              Impersonate="no" 
              Return="asyncNoWait" />

<InstallExecuteSequence>
     <Custom Action="CopyLogFile" OnExit="success" />
</InstallExecuteSequence>
like image 111
Isaiah4110 Avatar answered Oct 29 '25 01:10

Isaiah4110


Look in:

C:\Users\user-id\AppData\Local\Temp\Charting_Companion_YYYYMMDDhhmmss_000_Setup.log

like image 43
Pierre Avatar answered Oct 29 '25 00:10

Pierre



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!