MuxLogger Class

Represents a multiplexing logger. The purpose of this logger is to register and unregister multiple loggers during the build. Supports the Visual Studio IDE scenario in which loggers are registered and unregistered for each project system’s build request. One physical build can have multiple logical builds, each with its own set of loggers.

The MuxLoggerregisters itself with the build manager as a regular central /l style logger. It receives messages from the build manager and routes them to the correct logger, based on the logical build that the message came from.

MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.

Inheritance Hierarchy

System.Object
  Microsoft.Build.Utilities.MuxLogger

Namespace:  Microsoft.Build.Utilities
Assembly:  Microsoft.Build.Utilities.Core (in Microsoft.Build.Utilities.Core.dll)

Syntax

'Declaration
Public Class MuxLogger _
    Implements INodeLogger, ILogger
public class MuxLogger : INodeLogger, ILogger
public ref class MuxLogger : INodeLogger, 
    ILogger
type MuxLogger =  
    class 
        interface INodeLogger 
        interface ILogger 
    end
public class MuxLogger implements INodeLogger, ILogger

The MuxLogger type exposes the following members.

Constructors

  Name Description
Public method MuxLogger Creates a new instance of the multiplexing logger.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.

Top

Properties

  Name Description
Public property Parameters Gets and sets the Parameters attribute, required by the ILogger interface.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public property Verbosity Gets and sets the Verbosity attribute, required by the ILogger interface.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.

Top

Methods

  Name Description
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Public method Initialize(IEventSource) Initialize the MuxLogger instance with the specified event source.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method Initialize(IEventSource, Int32) Initialize the MuxLogger instance with the specified event source and specified maximum number of nodes.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Protected method MemberwiseClone (Inherited from Object.)
Public method RegisterLogger Registers a logger on the MuxLogger and raises a build-started event if the build-started event has already been logged.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method Shutdown Shuts down the MuxLogger and clears out any state.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Public method ToString (Inherited from Object.)
Public method UnregisterLoggers Removes the specified logger from the MuxLogger.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.

Top

Remarks

The MuxLoggergenerally functions as follows:

  • The MuxLogger is registered at the beginning of the build manager’s Begin build.

    Any loggers registered before the build manager starts the build get the build-started event at the same time as the MuxLogger.

    Any loggers registered after the build manager starts the build get a synthesized build-started event. The event cannot be cached because the timestamp of the build-started event is determined when the event is created, and caching the event would give incorrect build times in the loggers registered to the MuxLogger.

  • The MuxLogger is initialized by the build manager

    The MuxLogger listens to all events on the event source from the build manager and routes events correctly to the registered loggers.

  • The MuxLogger is shutdown when the build is finished in end build. At this time, it unregisters any loggers attached to it.

  • The MuxLogger logs the build-finished event when the project-finished event for the first project-started event is seen for each logger.

The MuxLogger registers loggers in the following way:

  1. The logger is passed to the MuxLogger.RegisterLogger method with a submission ID that is used to route a message to that logger.

  2. The MuxLogger registers the logger to the MuxLogger event source.

  3. If the build-started event has already been logged, the MuxLogger creates a new build-started event and sends it to the logger’s event source.

The MuxLogger unregisters loggers in the following way:

  1. When a build submission is completed, the MuxLogger.UnregisterLogger method is called with the submission ID for the logger.

  2. The MuxLogger looks up the success state of the project-finished event for the submission ID and logs a build-finished event to the logger.

  3. The MuxLoggercleans up the event source.

    Note that the unregister comes from a thread other than the logging thread and a synchronization issue could occur if unregister is called while events are being logged.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Build.Utilities Namespace