FileLogTraceListener.TraceData 方法

定義

將追蹤資料寫入輸出檔案。

多載

名稱 Description
TraceData(TraceEventCache, String, TraceEventType, Int32, Object)

會將追蹤資訊、資料物件和事件資訊寫入輸出檔案或串流。

TraceData(TraceEventCache, String, TraceEventType, Int32, Object[])

會將追蹤資訊、資料物件陣列及事件資訊寫入輸出檔案或串流。

備註

TraceData 方法並非設計用來由應用程式程式碼呼叫。 這些方法由 、 TraceTraceSource 類別的成員Debug呼叫,將追蹤資料寫入輸出。

TraceData(TraceEventCache, String, TraceEventType, Int32, Object)

來源:
FileLogTraceListener.vb
來源:
FileLogTraceListener.vb
來源:
FileLogTraceListener.vb
來源:
FileLogTraceListener.vb
來源:
FileLogTraceListener.vb

會將追蹤資訊、資料物件和事件資訊寫入輸出檔案或串流。

public:
 override void TraceData(System::Diagnostics::TraceEventCache ^ eventCache, System::String ^ source, System::Diagnostics::TraceEventType eventType, int id, System::Object ^ data);
public override void TraceData(System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, object data);
override this.TraceData : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * obj -> unit
Public Overrides Sub TraceData (eventCache As TraceEventCache, source As String, eventType As TraceEventType, id As Integer, data As Object)

參數

eventCache
TraceEventCache

一個 TraceEventCache 包含目前程序 ID、執行緒 ID 及堆疊追蹤資訊的物件。

source
String

這是使用此方法的追蹤源名稱。

eventType
TraceEventType

其中一個 TraceEventType 列舉值。

id
Int32

事件的數字識別碼。

data
Object

要發出的追蹤資料。

備註

此方法:

  1. 格式化輸出所需的資料與上下文資訊。

  2. 必要時建立新的日誌檔。

  3. 將資訊寫入日誌檔案。

欲了解更多建立新日誌檔案的資訊,請參見 FullLogFileName

下表列出輸出欄位的出現順序。 欄位由該 Delimiter 性質指定的字串界定,後面接著一個線終止符。

欄位 輸出條件 說明
source 永遠 name 的值。
severity 永遠 eventType列舉值名稱。
id 永遠 id字串表示。
message 永遠 data字串表示。
callStack Callstack 該物件設定了旗標 TraceOutputOptions eventCache性質。Callstack
CorrelationID LogicalOperationStack 該物件設定了旗標 TraceOutputOptions eventCache性質。ThreadId
DateTime DateTime 該物件設定了旗標 TraceOutputOptions 的屬性eventCache的串表示DateTime。 不變文化用於字串轉換。
ProcessID ProcessId 該物件設定了旗標 TraceOutputOptions 的屬性eventCache的串表示ProcessId。 不變文化用於字串轉換。
ThreadID ThreadId 該物件設定了旗標 TraceOutputOptions eventCache性質。ThreadId
Timestamp Timestamp 該物件設定了旗標 TraceOutputOptions 的屬性eventCache的串表示Timestamp。 不變文化用於字串轉換。
HostName 當性質 IncludeHostNameTrue時。 計算機的名稱。

另請參閱

適用於

TraceData(TraceEventCache, String, TraceEventType, Int32, Object[])

來源:
FileLogTraceListener.vb
來源:
FileLogTraceListener.vb
來源:
FileLogTraceListener.vb
來源:
FileLogTraceListener.vb
來源:
FileLogTraceListener.vb

會將追蹤資訊、資料物件陣列及事件資訊寫入輸出檔案或串流。

public:
 override void TraceData(System::Diagnostics::TraceEventCache ^ eventCache, System::String ^ source, System::Diagnostics::TraceEventType eventType, int id, ... cli::array <System::Object ^> ^ data);
public override void TraceData(System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, params object[] data);
override this.TraceData : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * obj[] -> unit
Public Overrides Sub TraceData (eventCache As TraceEventCache, source As String, eventType As TraceEventType, id As Integer, ParamArray data As Object())

參數

eventCache
TraceEventCache

一個 TraceEventCache 包含目前程序 ID、執行緒 ID 及堆疊追蹤資訊的物件。

source
String

這是觸發此方法的追蹤源名稱。

eventType
TraceEventType

其中一個 TraceEventType 列舉值。

id
Int32

事件的數字識別碼。

data
Object[]

一組要以資料形式發出的物件陣列。

備註

此方法:

  1. 格式化輸出所需的資料與上下文資訊,

  2. 必要時建立新的日誌檔,

  3. 將資訊寫入日誌檔案。

欲了解更多建立新日誌檔案的資訊,請參見 FullLogFileName

此表列出輸出欄位的出現順序。 欄位由該 Delimiter 性質指定的字串界定,後面接著一個線終止符。

欄位 輸出條件 說明
source 永遠 name 的值。
severity 永遠 eventType列舉值名稱。
id 永遠 id字串表示。
message 永遠 由 中 data每個元素的字串表示組成,每個元素被 Delimiter分隔。
callStack Callstack 該物件設定了旗標 TraceOutputOptions eventCache性質。Callstack
CorrelationID LogicalOperationStack 該物件設定了旗標 TraceOutputOptions eventCache性質。ThreadId
DateTime DateTime 該物件設定了旗標 TraceOutputOptions 的屬性eventCache的串表示DateTime。 不變文化用於字串轉換。
ProcessID ProcessId 該物件設定了旗標 TraceOutputOptions 的屬性eventCache的串表示ProcessId。 不變文化用於字串轉換。
ThreadID ThreadId 該物件設定了旗標 TraceOutputOptions eventCache性質。ThreadId
Timestamp Timestamp 該物件設定了旗標 TraceOutputOptions 的屬性eventCache的串表示Timestamp。 不變文化用於字串轉換。
HostName 當性質 IncludeHostNameTrue時。 計算機的名稱。

另請參閱

適用於