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 에 응답할 준비를 해야 합니다.

적용 대상