LogProviderBase.OpenLog 메서드

정의

패키지 실행 시작 시 호출되어 외부 데이터 소스와의 연결을 설정합니다.

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

예제

다음 예시는 속성에 명시된 ConfigString 것을 ConnectionManager 사용하여 외부 텍스트 파일에 연결하는 방법을 보여줍니다. 연결 변수는

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

적용 대상