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  

注解

当发生来自 IDTSEventsIDTSInfoEvents 接口的事件时,将调用此方法。

使用此方法在包执行时写入日志条目。

此方法的参数提供有关事件开始时间、引发事件的对象等的信息。

适用于