Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

LogProviderBase.OpenLog Method ()

 

Applies To: SQL Server 2016 Preview

Called at the beginning of package execution to establish connections to external data sources.

Namespace:   Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)

public virtual void OpenLog()

This method is called at the beginning of package execution and prior to any execution events occurring. You should use this method to establish connections to external data sources and prepare to respond to calls to the Log method.

Legacy Code Example

The following example demonstrates connecting to an external text file using the ConnectionManager specified in the ConfigString property. The connection variable was cached from the

InitializeLogProvider method.

public override void OpenLog()
{
    //    Get the ConnectionManager from the package's
    //    Connections collection.
    connectionManager cm = connections[ConfigString];
    //    AcquireConnection for a file ConnectionManager
    //    retrieves the path to the file.
    string path = (string)cm.AcquireConnection(null);
    //    Instantiate the stream writer, and writes the opening
    //    log entry.
    this.sw = new StreamWriter(path);
    sw.WriteLine("OpenLog: " + DateTime.Now.ToShortDateString());
}
Return to top
Show:
© 2015 Microsoft