SetupLogError function

[This function is available for use in the operating systems indicated in the Requirements section. It may be altered or unavailable in subsequent versions. SetupAPI should no longer be used for installing applications. Instead, use the Windows Installer for developing application installers. SetupAPI continues to be used for installing device drivers.]

The SetupLogError function writes an error message to a log file. It is meant to be used during the installation of Windows, but it is always available. It is not intended to be used after the operating system is installed — the event log should be used instead.


BOOL SetupLogError(
  _In_ PCTSTR      MessageString,
  _In_ LogSeverity Severity


MessageString [in]

Pointer to the string that should be saved to Setup's log. The message must end with a return-linefeed combination (\r\n). You should use a null-terminated string. The null-terminated string should not exceed the size of the destination buffer. The message is always saved to the action log, setupact.log. If Severity is LogSevWarning, LogSevError, or LogSevFatalError, Setup also saves the message to the error log, setuperr.log. Both logs are stored in the Windows directory.

Severity [in]

Severity of the message, one of the following: LogSevInformation, LogSevWarning, LogSevError, or LogSevFatalError.

Return value

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.


  • The action log is intended for recording all modifications made to the system during installation of Windows.
  • The error log is intended for errors during installation of Windows only.
  • The MessageString parameter may be formatted further by Setup (though it does no additional processing now).
  • The error log will be presented to the user at the end of system setup.


Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]







Unicode and ANSI names

SetupLogErrorW (Unicode) and SetupLogErrorA (ANSI)

See also