共用方式為


SelectedLogProviders.Add Method

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

命名空間: Microsoft.SqlServer.Dts.Runtime
組件: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

語法

'宣告
Public Sub Add ( _
    logProvider As LogProvider _
)
public void Add (
    LogProvider logProvider
)
public:
void Add (
    LogProvider^ logProvider
)
public void Add (
    LogProvider logProvider
)
public function Add (
    logProvider : LogProvider
)

參數

  • logProvider
    The log provider to add to the collection.

備註

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.

範例

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)

執行緒安全性

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

平台

開發平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

目標平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

請參閱

參考

SelectedLogProviders Class
SelectedLogProviders Members
Microsoft.SqlServer.Dts.Runtime Namespace