17

I am new to the WiX installer.

I am using Session.Log to log some useful data for the process.

session.Log("Begin register the Vdds interface.");

But I am not sure where can find the log. Is there a default path where it logs? Or should I need to specify the path that I need to provide in installer .wxs file?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Keshavdas M
  • 674
  • 2
  • 7
  • 25

5 Answers5

23

You will need to run your installer from the command line using msiexec.exe and then include the L command line option to specify where the logs are to be saved.

For example:

msiexec /i app.msi /l*v thelog.txt

For more information about msiexec's parameters see Command-Line Options

Jon
  • 9,156
  • 9
  • 56
  • 73
rfernandes
  • 1,121
  • 7
  • 9
  • 2
    Thank you, it logs into user temp directory with MSIXXXXX.Log by default see http://support.microsoft.com/kb/2545723 and more information section. – Keshavdas M Jun 04 '14 at 06:52
  • 9
    I use the /L*V option and my `Session.Log` doesn't appear in the resulting log file. Where else might it go? – Brandon Nov 05 '15 at 14:27
  • 3
    It's probably going into the void of windows installer... I'm having the same issues and what I've found is that [if you are invoking the custom action by clicking a button](http://stackoverflow.com/a/3503257/187955) (versus invoking it as part of install sequence) messages will not be logged. Many other methods will not work as well (methods which rely on MsiProcessMessage). Logging can be worked around, but I'm now looking for workarounds for other functionality (such as showing error dialog). – Nikola Radosavljević Jan 13 '16 at 16:32
  • 1
    Thank you Really Helped. it logs where msi is placed. – Purohit Hitesh Feb 07 '20 at 06:01
4

Session.Log adds your log to the standard MSI Log. In case you provided the /l*v <LogPath> switch during execution, logs of custom action would be found in LogPath.

In case you used Property MsiLogging with value as vx in installer, it would generate Standard MSI Log in user temp location (type %temp% in run), with LogName looking like MSI*.LOG, automatically even without the /L*v switch. LogPath could be overridden though with the /L*v switch.

Things you must know:

  1. session.Log does not log when executed by any UI action.

  2. Sometimes the installer cannot generate the MSI* log because of memory leak issues. In this scenario, you could restart the explorer.exe process.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ashish Kamat
  • 567
  • 4
  • 16
3
  1. session.Log works like session.Message with Info level:

    public void Log(string msg)
    {
        if (msg == null)
            throw new ArgumentNullException("msg");
    
        using (Record record = new Record(0))
        {
            record.FormatString = msg;
            int num = (int) this.Message(InstallMessage.Info, record);
        }
    }
    
  2. You can use dirty trick: define a property in the referencing module and set its value in CA to a message You want to log. It seems that WIX logs changes of properties:

<Property Id="WIX_MAGIX_TRICK_PROPERTY" Value="0" />

and in CA:

session["WIX_MAGIX_TRICK_PROPERTY"] = "message to log";

The result should be similar to this:

MSI (c) (78!34) [09:48:13:770]: PROPERTY CHANGE: Modifying WIX_MAGIX_TRICK_PROPERTY property. Its current value is '0'. Its new value: 'message to log'.

sk_ra
  • 69
  • 2
1

Running the msi with the arguments: /L!*vx solved this for me. E.g.

msiexec /i MyMsi.msi /L!*vx install.log

Now all my calls to Session.Log("..") now show in install.log

0

I am not sure where session.Log logs messages. However session.Message:

Record record = new Record();
record.FormatString = string.Format("Something has gone right!");

session.Message(InstallMessage.Info, record);

shows up in the log file generated by:

msiexec /i app.msi /l*v thelog.txt
Ashish Kamat
  • 567
  • 4
  • 16
Colin
  • 588
  • 6
  • 9