Metodo LogProviderBase.Log

Called when a runtime event occurs during package execution.

Spazio dei nomi  Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)

Sintassi

'Dichiarazione
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() _
)
'Utilizzo
Dim instance As LogProviderBase 
Dim logEntryName As String 
Dim computerName As String 
Dim operatorName As String 
Dim sourceName As String 
Dim sourceID As String 
Dim executionID As String 
Dim messageText As String 
Dim startTime As DateTime 
Dim endTime As DateTime 
Dim dataCode As Integer 
Dim dataBytes As Byte()

instance.Log(logEntryName, computerName, _
    operatorName, sourceName, sourceID, _
    executionID, messageText, startTime, _
    endTime, dataCode, 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
)
public:
virtual void Log(
    String^ logEntryName, 
    String^ computerName, 
    String^ operatorName, 
    String^ sourceName, 
    String^ sourceID, 
    String^ executionID, 
    String^ messageText, 
    DateTime startTime, 
    DateTime endTime, 
    int dataCode, 
    array<unsigned char>^ dataBytes
)
abstract Log : 
        logEntryName:string * 
        computerName:string * 
        operatorName:string * 
        sourceName:string * 
        sourceID:string * 
        executionID:string * 
        messageText:string * 
        startTime:DateTime * 
        endTime:DateTime * 
        dataCode:int * 
        dataBytes:byte[] -> unit  
override Log : 
        logEntryName:string * 
        computerName:string * 
        operatorName:string * 
        sourceName:string * 
        sourceID:string * 
        executionID:string * 
        messageText:string * 
        startTime:DateTime * 
        endTime:DateTime * 
        dataCode:int * 
        dataBytes:byte[] -> unit
public function Log(
    logEntryName : String, 
    computerName : String, 
    operatorName : String, 
    sourceName : String, 
    sourceID : String, 
    executionID : String, 
    messageText : String, 
    startTime : DateTime, 
    endTime : DateTime, 
    dataCode : int, 
    dataBytes : byte[]
)

Parametri

  • computerName
    Tipo: System.String
    The name of the computer on which the package is executing.
  • operatorName
    Tipo: System.String
    The user account executing the package.
  • sourceName
    Tipo: System.String
    The name of the object raising the event.
  • sourceID
    Tipo: System.String
    The ID of the object raising the event.
  • executionID
    Tipo: System.String
    The execution ID of the executing package.
  • startTime
    Tipo: System.DateTime
    The start time of the action causing this event.
  • endTime
    Tipo: System.DateTime
    The end time of the action causing this event.

Osservazioni

This method is called when an event from the IDTSEvents or IDTSInfoEvents interfaces occur.

You use this method to write log entries as a package executes.

The parameters to this method provide information about when the event began, the object that raised the event, and so on.

Esempi

The Log method is called each time an object in the package raises an event by calling a FireEvent method on one of the event interfaces. There are multiple event interfaces, each of which may contain a subset of the events defined in the IDTSEvents interface. Included in this interface is the FireCustomEvent method, which is the event that objects with custom events use to raise the event.

The following code example implements the Log method, and writes the events to the stream that was opened in the previous section.

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

Vedere anche

Riferimento

LogProviderBase Classe

Spazio dei nomi Microsoft.SqlServer.Dts.Runtime