Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 2.0
 LogMessage Method

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
.NET Framework Class Library
InstallContext.LogMessage Method

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

Namespace: System.Configuration.Install
Assembly: System.Configuration.Install (in system.configuration.install.dll)

Visual Basic (Declaration)
Public Sub LogMessage ( _
    message As String _
)
Visual Basic (Usage)
Dim instance As InstallContext
Dim message As String

instance.LogMessage(message)
C#
public void LogMessage (
    string message
)
C++
public:
void LogMessage (
    String^ message
)
J#
public void LogMessage (
    String message
)
JScript
public function LogMessage (
    message : String
)

Parameters

message

The message to write.

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.

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.

Visual Basic
' 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
C#
// 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" );

C++
// 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" );

J#
// 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");

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker