Rediger

Del via


InstallContext.LogMessage(String) Method

Definition

Writes a message to the console and to the log file for the installation.

public:
 void LogMessage(System::String ^ message);
public void LogMessage (string message);
member this.LogMessage : string -> unit
Public Sub LogMessage (message As String)

Parameters

message
String

The message to write.

Examples

This example is an excerpt of the example in the class overview of InstallContext class.

It uses the IsParameterTrue method to find out if the LogtoConsole parameter has been set. If yes, it will then use the LogMessage method to write status messages to the installation log file and the console.

// Check whether the "LogtoConsole" parameter has been set.
if ( myInstallContext->IsParameterTrue( "LogtoConsole" ) )
{
   // Display the message to the console and add it to the logfile.
   myInstallContext->LogMessage( "The 'Install' method has been called" );
}
// Check whether the "LogtoConsole" parameter has been set.
if( myInstallContext.IsParameterTrue( "LogtoConsole" ) == true )
{
   // Display the message to the console and add it to the logfile.
   myInstallContext.LogMessage( "The 'Install' method has been called" );
}
' Check wether the "LogtoConsole" parameter has been set.
If myInstallContext.IsParameterTrue("LogtoConsole") = True Then
   ' Display the message to the console and add it to the logfile.
   myInstallContext.LogMessage("The 'Install' method has been called")
End If

Remarks

An installer can call this method to write progress or other status information to the log file. If the command-line parameters specify that a user interface should be displayed, the installer should show message boxes or make queries in addition to calling the LogMessage method. Text written to the log file will not be seen by the user unless InstallUtil.exe is used to run the installation and "/LogToConsole= true" is specified in the command line.

Applies to

See also