LogProviderBase.OpenLog メソッド

定義

パッケージ実行の開始時に呼び出されて、外部データ ソースとの接続を確立します。

public:
 virtual void OpenLog();
public virtual void OpenLog ();
abstract member OpenLog : unit -> unit
override this.OpenLog : unit -> unit
Public Overridable Sub OpenLog ()

次の例では、ConnectionManager プロパティで指定された ConfigString を使用して、外部のテキスト ファイルに接続しています。 接続変数は、

InitializeLogProvider メソッド

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());  
}  
Public Overrides  Sub OpenLog()  
    '    Get the ConnectionManager from the package's  
    '    Connections collection.  
    Dim cm As connectionManager =  connections(ConfigString)   
    '    AcquireConnection for a file ConnectionManager  
    '    retrieves the path to the file.  
    Dim path As String = CType(cm.AcquireConnection(Nothing), String)  
    '    Instantiate the stream writer, and writes the opening  
    '    log entry.  
    Me.sw = New StreamWriter(path)  
    sw.WriteLine("OpenLog: " + DateTime.Now.ToShortDateString())  
End Sub  

注釈

このメソッドは、パッケージ実行の開始時、どの実行イベントの発生よりも先に呼び出されます。 外部データ ソースへの接続を確立し、Log メソッドへの呼び出しに対する応答を準備するには、このメソッドを使用する必要があります。

適用対象