Share via


SelectedLogProviders.Add(LogProvider) Method

Definition

Adds the specified log provider object, LogProvider, to the end of the collection.

public:
 void Add(Microsoft::SqlServer::Dts::Runtime::LogProvider ^ logProvider);
public void Add (Microsoft.SqlServer.Dts.Runtime.LogProvider logProvider);
member this.Add : Microsoft.SqlServer.Dts.Runtime.LogProvider -> unit
Public Sub Add (logProvider As LogProvider)

Parameters

logProvider
LogProvider

The log provider to add to the collection.

Examples

The following code example creates a log provider, then selects is as the log provider for the package.

LogProvider provider = package.LogProviders.Add("DTS.LogProviderXMLFile.1");  
provider.ConfigString = "c:\\DTSPackageLog.xml";  
package.LoggingOptions.SelectedLogProviders.Add(provider);  

[Visual Basic]

Dim provider As LogProvider =   package.LogProviders.Add("DTS.LogProviderXMLFile.1")   
provider.ConfigString = "c:\\DTSPackageLog.xml"  
package.LoggingOptions.SelectedLogProviders.Add(provider)  

Remarks

This method associates a log provider to a specific container. The package is a type of container, so the code example specifies that all logs for the package go to DTS.LogProviderXMLFile.1.

You can set a SelectedLogProvider for any task by using the tasks' LoggingOptions collection inherited from DtsContainer, just like the sample shows for the package.

Applies to