/// <summary> /// Enables logging of the selected message type for all subsequent install sessions in /// the current process space. /// </summary> /// <param name="logModes">One or more mode flags specifying the type of messages to log</param> /// <param name="logFile">Full path to the log file. A null path disables logging, /// in which case the logModes paraneter is ignored.</param> /// <param name="append">If true, the log lines will be appended to any existing file content. /// If false, the log file will be truncated if it exists. The default is false.</param> /// <param name="flushEveryLine">If true, the log will be flushed after every line. /// If false, the log will be flushed every 20 lines. The default is true.</param> /// <exception cref="ArgumentException">an invalid log mode was specified</exception> /// <remarks><p> /// This method takes effect on any new installation processes. Calling this /// method from within a custom action will not start logging for that installation. /// </p><p> /// Win32 MSI API: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msienablelog.asp">MsiEnableLog</a> /// </p></remarks> public static void EnableLog(InstallLogModes logModes, string logFile, bool append, bool flushEveryLine) { uint ret = NativeMethods.MsiEnableLog((uint)logModes, logFile, (append ? (uint)1 : 0) + (flushEveryLine ? (uint)2 : 0)); if (ret != 0 && ret != (uint)NativeMethods.Error.FILE_INVALID) { throw InstallerException.ExceptionFromReturnCode(ret); } }