語言

LogProviderBase.Log 方法

定義

當執行時事件發生於套件執行時呼叫。

public:
 virtual void Log(System::String ^ logEntryName, System::String ^ computerName, System::String ^ operatorName, System::String ^ sourceName, System::String ^ sourceID, System::String ^ executionID, System::String ^ messageText, DateTime startTime, DateTime endTime, int dataCode, cli::array <System::Byte> ^ dataBytes);
public virtual void Log(string logEntryName, string computerName, string operatorName, string sourceName, string sourceID, string executionID, string messageText, DateTime startTime, DateTime endTime, int dataCode, byte[] dataBytes);
abstract member Log : string * string * string * string * string * string * string * DateTime * DateTime * int * byte[] -> unit
override this.Log : string * string * string * string * string * string * string * DateTime * DateTime * int * byte[] -> unit
Public Overridable Sub Log (logEntryName As String, computerName As String, operatorName As String, sourceName As String, sourceID As String, executionID As String, messageText As String, startTime As DateTime, endTime As DateTime, dataCode As Integer, dataBytes As Byte())

參數

logEntryName
String

事件的名稱。

computerName
String

該套件執行的電腦名稱。

operatorName
String

執行套件的使用者帳號。

sourceName
String

引發事件的物體名稱。

sourceID
String

觸發事件的物件ID。

executionID
String

執行套件的執行 ID。

messageText
String

活動簡訊。

startTime
DateTime

是導致此事件的行動開始時間。

endTime
DateTime

造成此事件的行動結束時間。

dataCode
Int32

數值資料欄位。

dataBytes
Byte[]

BLOB 資料欄位。

範例

Log每次套件中的物件在事件中呼叫事件時,會呼叫該方法,方法是呼叫其中一個事件介面上的 FireEvent 方法。 存在多個事件介面,每個介面可能包含介面 IDTSEvents 中定義事件的子集。 此介面 FireCustomEvent 包含方法,即擁有自訂事件的物件用來引發事件的事件。

以下程式碼範例實作了該 Log 方法,並將事件寫入前一段中開啟的串流。

public override void Log(string logEntryName, string computerName, string operatorName, string sourceName, string sourceID, string executionID, string messageText, DateTime startTime, DateTime endTime, int dataCode, byte[] dataBytes)  
{  
    sw.Write(logEntryName + ",");  
    sw.Write(computerName + ",");  
    sw.Write(operatorName + ",");  
    sw.Write(sourceName + ",");  
    sw.Write(sourceID + ",");  
    sw.Write(messageText + ",");  
    sw.Write(dataBytes + ",");  
    sw.WriteLine("");  
}  
Public Overrides  Sub Log(ByVal logEnTryName As String, ByVal computerName As String, ByVal operatorName As String, ByVal sourceName As String, ByVal sourceID As String, ByVal executionID As String, ByVal messageText As String, ByVal startTime As DateTime, ByVal endTime As DateTime, ByVal dataCode As Integer, ByVal dataBytes() As Byte)  
    sw.Write(logEnTryName + ",")  
    sw.Write(computerName + ",")  
    sw.Write(operatorName + ",")  
    sw.Write(sourceName + ",")  
    sw.Write(sourceID + ",")  
    sw.Write(messageText + ",")  
    sw.Write(dataBytes + ",")  
    sw.WriteLine("")  
End Sub  

備註

當 or IDTSInfoEvents 介面發生事件IDTSEvents時,會呼叫此方法。

你可以用這個方法在套件執行時寫入日誌條目。

此方法的參數提供事件開始時間、引發事件的物件等資訊。

適用於