TraceSource 클래스

정의

코드 실행을 추적하고 추적 메시지를 소스와 연결하는 데 필요한 메서드 및 속성 집합을 제공합니다.

public ref class TraceSource
public class TraceSource
type TraceSource = class
Public Class TraceSource
상속
TraceSource

예제

다음 코드 예제에서는 클래스를 TraceSource 사용하여 추적을 수신기에 전달하는 방법을 보여 줍니다. 이 예제에서는 스위치 및 필터 사용량도 보여 줍니다.

/////////////////////////////////////////////////////////////////////////////////
//
// NAME     TraceSource2.cpp : main project file
//
/////////////////////////////////////////////////////////////////////////////////



// The following configuration file can be used with this sample.
// When using a configuration file #define ConfigFile.
//            <source name="TraceTest" switchName="SourceSwitch" switchType="System.Diagnostics.SourceSwitch" >
//                    <add name="console" type="System.Diagnostics.ConsoleTraceListener" initializeData="false" />
//                    <remove name ="Default" />
//            <!-- You can set the level at which tracing is to occur -->
//            <add name="SourceSwitch" value="Warning" />
//            <!-- You can turn tracing off -->
//            <!--add name="SourceSwitch" value="Off" -->
//        <trace autoflush="true" indentsize="4"></trace>

#define TRACE
//#define ConfigFile

#using <System.dll>

using namespace System;
using namespace System::Collections;
using namespace System::Diagnostics;
using namespace System::Reflection;
using namespace System::IO;
using namespace System::Security::Permissions;

void DisplayProperties(TraceSource^ ts);  // Forward Declaration


int main()
{
    TraceSource^ ts = gcnew TraceSource("TraceTest");

    try
        {
        // Initialize trace switches.
#if(!ConfigFile)
        SourceSwitch^ sourceSwitch = gcnew SourceSwitch("SourceSwitch", "Verbose");
        ts->Switch = sourceSwitch;
        int idxConsole = ts->Listeners->Add(gcnew System::Diagnostics::ConsoleTraceListener());
        ts->Listeners[idxConsole]->Name = "console";
#endif
        DisplayProperties(ts);
        ts->Listeners["console"]->TraceOutputOptions |= TraceOptions::Callstack;
        ts->TraceEvent(TraceEventType::Warning, 1);
        ts->Listeners["console"]->TraceOutputOptions = TraceOptions::DateTime;
        // Issue file not found message as a warning.
        ts->TraceEvent(TraceEventType::Warning, 2, "File Test not found");
        // Issue file not found message as a verbose event using a formatted string.
        ts->TraceEvent(TraceEventType::Verbose, 3, "File {0} not found.", "test");
        // Issue file not found message as information.
        ts->TraceInformation("File {0} not found.", "test");
        ts->Listeners["console"]->TraceOutputOptions |= TraceOptions::LogicalOperationStack;
        // Issue file not found message as an error event.
        ts->TraceEvent(TraceEventType::Error, 4, "File {0} not found.", "test");

        // Test the filter on the ConsoleTraceListener.
        ts->Listeners["console"]->Filter = gcnew SourceFilter("No match");
        ts->TraceData(TraceEventType::Error, 5,
            "SourceFilter should reject this message for the console trace listener.");
        ts->Listeners["console"]->Filter = gcnew SourceFilter("TraceTest");
        ts->TraceData(TraceEventType::Error, 6,
            "SourceFilter should let this message through on the console trace listener.");
        ts->Listeners["console"]->Filter = nullptr;

        // Use the TraceData method. 
        ts->TraceData(TraceEventType::Warning, 7, gcnew array<Object^>{ "Message 1", "Message 2" });

        // Activity tests.
        ts->TraceEvent(TraceEventType::Start, 9, "Will not appear until the switch is changed.");
        ts->Switch->Level = SourceLevels::ActivityTracing | SourceLevels::Critical;
        ts->TraceEvent(TraceEventType::Suspend, 10, "Switch includes ActivityTracing, this should appear");
        ts->TraceEvent(TraceEventType::Critical, 11, "Switch includes Critical, this should appear");
        ts->Flush();
        ts->Close();
        Console::WriteLine("Press enter key to exit.");
        Console::Read();
        }
    catch (Exception ^e)
        {
         // Catch any unexpected exception.
         Console::WriteLine("Unexpected exception: " + e->ToString());
         Console::Read();
        }
}


void DisplayProperties(TraceSource^ ts)
{
    Console::WriteLine("TraceSource name = " + ts->Name);
//    Console::WriteLine("TraceSource switch level = " + ts->Switch->Level);         // error C3063: operator '+': all operands must have the same enumeration type
    Console::WriteLine("TraceSource switch level = {0}", ts->Switch->Level);         //  SUCCESS:  does compile.  Weird
    Console::WriteLine("TraceSource Attributes Count " + ts->Attributes->Count);     //  SUCCESS:  also compiles.  Really weird
    Console::WriteLine("TraceSource Attributes Count = {0}", ts->Attributes->Count); //  SUCCESS:  okay, I give up.  Somebody call me a cab.

    Console::WriteLine("TraceSource switch = " + ts->Switch->DisplayName);
    array<SwitchAttribute^>^ switches = SwitchAttribute::GetAll(TraceSource::typeid->Assembly);

    for (int i = 0; i < switches->Length; i++)
        { 
        Console::WriteLine("Switch name = " + switches[i]->SwitchName);
        Console::WriteLine("Switch type = " + switches[i]->SwitchType);
        }

#if(ConfigFile)
            // Get the custom attributes for the TraceSource.
            Console::WriteLine("Number of custom trace source attributes = "
                + ts.Attributes.Count);
            foreach (DictionaryEntry de in ts.Attributes)
                Console::WriteLine("Custom trace source attribute = "
                    + de.Key + "  " + de.Value);
            // Get the custom attributes for the trace source switch.
            foreach (DictionaryEntry de in ts.Switch.Attributes)
                Console::WriteLine("Custom switch attribute = "
                    + de.Key + "  " + de.Value);
#endif
       Console::WriteLine("Number of listeners = " + ts->Listeners->Count);
       for each (TraceListener ^ traceListener in ts->Listeners)
           {
           Console::Write("TraceListener: " + traceListener->Name + "\t");
           // The following output can be used to update the configuration file.
           Console::WriteLine("AssemblyQualifiedName = " +
               (traceListener->GetType()->AssemblyQualifiedName));
           }
}
// The following configuration file can be used with this sample.
// When using a configuration file #define ConfigFile.
//            <source name="TraceTest" switchName="SourceSwitch" switchType="System.Diagnostics.SourceSwitch" >
//                    <add name="console" type="System.Diagnostics.ConsoleTraceListener" initializeData="false" />
//                    <remove name ="Default" />
//            <!-- You can set the level at which tracing is to occur -->
//            <add name="SourceSwitch" value="Warning" />
//            <!-- You can turn tracing off -->
//            <!--add name="SourceSwitch" value="Off" -->
//        <trace autoflush="true" indentsize="4"></trace>
#define TRACE
//#define ConfigFile

using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.IO;
using System.Security.Permissions;

namespace Testing
{
    class TraceTest
    {
        // Initialize the trace source.
        static TraceSource ts = new TraceSource("TraceTest");
        [SwitchAttribute("SourceSwitch", typeof(SourceSwitch))]
        static void Main()
        {
            try
            {
                // Initialize trace switches.
#if(!ConfigFile)
                SourceSwitch sourceSwitch = new SourceSwitch("SourceSwitch", "Verbose");
                ts.Switch = sourceSwitch;
                int idxConsole = ts.Listeners.Add(new System.Diagnostics.ConsoleTraceListener());
                ts.Listeners[idxConsole].Name = "console";
#endif
                DisplayProperties(ts);
                ts.Listeners["console"].TraceOutputOptions |= TraceOptions.Callstack;
                ts.TraceEvent(TraceEventType.Warning, 1);
                ts.Listeners["console"].TraceOutputOptions = TraceOptions.DateTime;
                // Issue file not found message as a warning.
                ts.TraceEvent(TraceEventType.Warning, 2, "File Test not found");
                // Issue file not found message as a verbose event using a formatted string.
                ts.TraceEvent(TraceEventType.Verbose, 3, "File {0} not found.", "test");
                // Issue file not found message as information.
                ts.TraceInformation("File {0} not found.", "test");
                ts.Listeners["console"].TraceOutputOptions |= TraceOptions.LogicalOperationStack;
                // Issue file not found message as an error event.
                ts.TraceEvent(TraceEventType.Error, 4, "File {0} not found.", "test");
                // Test the filter on the ConsoleTraceListener.
                ts.Listeners["console"].Filter = new SourceFilter("No match");
                ts.TraceData(TraceEventType.Error, 5,
                    "SourceFilter should reject this message for the console trace listener.");
                ts.Listeners["console"].Filter = new SourceFilter("TraceTest");
                ts.TraceData(TraceEventType.Error, 6,
                    "SourceFilter should let this message through on the console trace listener.");
                ts.Listeners["console"].Filter = null;
                // Use the TraceData method.
                ts.TraceData(TraceEventType.Warning, 7, new object());
                ts.TraceData(TraceEventType.Warning, 8, new object[] { "Message 1", "Message 2" });
                // Activity tests.
                ts.TraceEvent(TraceEventType.Start, 9, "Will not appear until the switch is changed.");
                ts.Switch.Level = SourceLevels.ActivityTracing | SourceLevels.Critical;
                ts.TraceEvent(TraceEventType.Suspend, 10, "Switch includes ActivityTracing, this should appear");
                ts.TraceEvent(TraceEventType.Critical, 11, "Switch includes Critical, this should appear");
                ts.Flush();
                ts.Close();
                Console.WriteLine("Press any key to exit.");
                Console.Read();
            }
            catch (Exception e)
            {
                // Catch any unexpected exception.
                Console.WriteLine("Unexpected exception: " + e.ToString());
                Console.Read();
            }
        }
        public static void DisplayProperties(TraceSource ts)
        {
            Console.WriteLine("TraceSource name = " + ts.Name);
            Console.WriteLine("TraceSource switch level = " + ts.Switch.Level);
            Console.WriteLine("TraceSource switch = " + ts.Switch.DisplayName);
            SwitchAttribute[] switches = SwitchAttribute.GetAll(typeof(TraceTest).Assembly);
            for (int i = 0; i < switches.Length; i++)
            {
                Console.WriteLine("Switch name = " + switches[i].SwitchName);
                Console.WriteLine("Switch type = " + switches[i].SwitchType);
            }
#if(ConfigFile)
            // Get the custom attributes for the TraceSource.
            Console.WriteLine("Number of custom trace source attributes = "
                + ts.Attributes.Count);
            foreach (DictionaryEntry de in ts.Attributes)
                Console.WriteLine("Custom trace source attribute = "
                    + de.Key + "  " + de.Value);
            // Get the custom attributes for the trace source switch.
            foreach (DictionaryEntry de in ts.Switch.Attributes)
                Console.WriteLine("Custom switch attribute = "
                    + de.Key + "  " + de.Value);
#endif
            Console.WriteLine("Number of listeners = " + ts.Listeners.Count);
            foreach (TraceListener traceListener in ts.Listeners)
            {
                Console.Write("TraceListener: " + traceListener.Name + "\t");
                // The following output can be used to update the configuration file.
                Console.WriteLine("AssemblyQualifiedName = " +
                    (traceListener.GetType().AssemblyQualifiedName));
            }
        }
    }
}
' The following configuration file can be used with this sample.
' When using a configuration file #define ConfigFile.
'            <source name="TraceTest" switchName="SourceSwitch" switchType="System.Diagnostics.SourceSwitch" >
'                    <add name="console" type="System.Diagnostics.ConsoleTraceListener" initializeData="false" />
'                    <remove name ="Default" />
'            <!-- You can set the level at which tracing is to occur -->
'            <add name="SourceSwitch" value="Warning" />
'            <!-- You can turn tracing off -->
'            <!--add name="SourceSwitch" value="Off" -->
'        <trace autoflush="true" indentsize="4"></trace>
#Const TRACE = True
'#Const ConfigFile = True

Imports System.Collections
Imports System.Diagnostics
Imports System.Reflection
Imports System.IO
Imports System.Security.Permissions



Class TraceTest
    ' Initialize the trace source.
    Private Shared ts As New TraceSource("TraceTest")
    <SwitchAttribute("SourceSwitch", GetType(SourceSwitch))> _
    Shared Sub Main()
        Try
            ' Initialize trace switches.
#If (ConfigFile = False) Then
            Dim sourceSwitch As New SourceSwitch("SourceSwitch", "Verbose")
            ts.Switch = sourceSwitch
            Dim idxConsole As New Integer()
            idxConsole = ts.Listeners.Add(New System.Diagnostics.ConsoleTraceListener())
            ts.Listeners(idxConsole).Name = "console"
#End If
            DisplayProperties(ts)
            ts.Listeners("console").TraceOutputOptions = ts.Listeners("console").TraceOutputOptions Or TraceOptions.Callstack
            ts.TraceEvent(TraceEventType.Warning, 1)
            ts.Listeners("console").TraceOutputOptions = TraceOptions.DateTime
            ' Issue file not found message as a warning.
            ts.TraceEvent(TraceEventType.Warning, 2, "File Test not found")
            ' Issue file not found message as a verbose event using a formatted string.
            ts.TraceEvent(TraceEventType.Verbose, 3, "File {0} not found.", "test")
            ' Issue file not found message as information.
            ts.TraceInformation("File {0} not found.", "test")
            ts.Listeners("console").TraceOutputOptions = ts.Listeners("console").TraceOutputOptions Or TraceOptions.LogicalOperationStack
            ' Issue file not found message as an error event.
            ts.TraceEvent(TraceEventType.Error, 4, "File {0} not found.", "test")
            ' Test the filter on the ConsoleTraceListener.
            ts.Listeners("console").Filter = New SourceFilter("No match")
            ts.TraceData(TraceEventType.Error, 5, "SourceFilter should reject this message for the console trace listener.")
            ts.Listeners("console").Filter = New SourceFilter("TraceTest")
            ts.TraceData(TraceEventType.Error, 6, "SourceFilter should let this message through on the console trace listener.")
            ts.Listeners("console").Filter = Nothing
            ' Use the TraceData method. 
            ts.TraceData(TraceEventType.Warning, 7, New Object())
            ts.TraceData(TraceEventType.Warning, 8, New Object() {"Message 1", "Message 2"})
            ' Activity tests.
            ts.TraceEvent(TraceEventType.Start, 9, "Will not appear until the switch is changed.")
            ts.Switch.Level = SourceLevels.ActivityTracing Or SourceLevels.Critical
            ts.TraceEvent(TraceEventType.Suspend, 10, "Switch includes ActivityTracing, this should appear")
            ts.TraceEvent(TraceEventType.Critical, 11, "Switch includes Critical, this should appear")
            ts.Flush()
            ts.Close()
            Console.WriteLine("Press any key to exit.")
            Console.Read()
        Catch e As Exception
            ' Catch any unexpected exception.
            Console.WriteLine("Unexpected exception: " + e.ToString())
            Console.Read()
        End Try

    End Sub

    Public Shared Sub DisplayProperties(ByVal ts As TraceSource)
        Console.WriteLine("TraceSource name = " + ts.Name)
        Console.WriteLine("TraceSource switch level = " + ts.Switch.Level.ToString())
        Console.WriteLine("TraceSource switch = " + ts.Switch.DisplayName.ToString())
        Dim switches As SwitchAttribute() = SwitchAttribute.GetAll(GetType(TraceTest).Assembly)
        Dim i As Integer
        For i = 0 To switches.Length - 1
            Console.WriteLine("Switch name = " + switches(i).SwitchName.ToString())
            Console.WriteLine("Switch type = " + switches(i).SwitchType.ToString())
        Next i

#If (ConfigFile) Then
        ' Get the custom attributes for the TraceSource.
        Console.WriteLine("Number of custom trace source attributes = " + ts.Attributes.Count)
        Dim de As DictionaryEntry
        For Each de In ts.Attributes
            Console.WriteLine("Custom trace source attribute = " + de.Key + "  " + de.Value)
        Next de
        ' Get the custom attributes for the trace source switch.
        For Each de In ts.Switch.Attributes
            Console.WriteLine("Custom switch attribute = " + de.Key + "  " + de.Value)
        Next de
#End If
        Console.WriteLine("Number of listeners = " + ts.Listeners.Count.ToString())
        Dim traceListener As TraceListener
        For Each traceListener In ts.Listeners
            Console.Write("TraceListener: " + traceListener.Name + vbTab)
            ' The following output can be used to update the configuration file.
            Console.WriteLine("AssemblyQualifiedName = " + traceListener.GetType().AssemblyQualifiedName)
        Next traceListener

    End Sub
End Class

설명

TraceSource 클래스는 애플리케이션과 연결될 수 있는 추적을 만들기 위해 애플리케이션에서 사용됩니다. TraceSource에서는 이벤트를 쉽게 추적하고, 데이터를 추적하고, 정보 추적을 실행할 수 있는 추적 방법을 제공합니다.

.NET Framework 앱에서 의 TraceSource 추적 출력은 구성 파일 설정에 의해 제어할 수 있습니다. 구성 파일은 애플리케이션 실행 파일이 있는 폴더에 있으며 .config 확장명을 추가한 애플리케이션의 이름이 있습니다. 예를 들어 TraceSourceSample.exe 구성 파일의 이름은 TraceSourceSample.exe.config. 구성 파일을 사용하여 추적 정보를 보낼 위치와 추적할 작업 수준을 지정할 수 있습니다. 다음 예제에서는 샘플 .NET Framework 애플리케이션 구성 파일의 내용을 보여 줍니다.

<configuration>  
  <system.diagnostics>  
    <sources>  
      <source name="TraceTest" switchName="SourceSwitch"   
        switchType="System.Diagnostics.SourceSwitch" >  
        <listeners>  
          <add name="console" />  
          <remove name ="Default" />  
        </listeners>  
      </source>  
    </sources>  
    <switches>  
      <!-- You can set the level at which tracing is to occur -->  
      <add name="SourceSwitch" value="Warning" />  
        <!-- You can turn tracing off -->  
        <!--add name="SourceSwitch" value="Off" -->  
    </switches>  
    <sharedListeners>  
      <add name="console"   
        type="System.Diagnostics.ConsoleTraceListener"   
        initializeData="false"/>  
    </sharedListeners>  
    <trace autoflush="true" indentsize="4">  
      <listeners>  
        <add name="console" />  
      </listeners>  
    </trace>  
  </system.diagnostics>  
</configuration>  

TraceSource 클래스는 일반적으로 애플리케이션의 이름 원본의 이름으로 식별 됩니다. 특정 구성 요소에서 들어오는 추적 메시지는 특정 추적 원본에서 시작할 수 있으므로 해당 구성 요소에서 들어오는 모든 메시지를 쉽게 식별할 수 있습니다.

TraceSource 는 추적 메서드를 정의하지만 실제로는 추적 데이터를 생성하고 저장하기 위한 특정 메커니즘을 제공하지 않습니다. 추적 데이터는 추적 원본에서 로드할 수 있는 플러그 인인 추적 수신기에 의해 생성됩니다.

참고

종료하는 동안 추적 메서드를 호출해서는 안 됩니다. 이렇게 하면 가 ObjectDisposedException throw될 수 있습니다.

속성에 저장된 TraceSource.Listeners 컬렉션에 인스턴스를 추가하거나 제거하여 TraceListener 추적 출력의 대상을 사용자 지정할 수 있습니다. 기본적으로 추적 출력은 클래스의 instance 사용하여 생성됩니다DefaultTraceListener.

앞의 .NET Framework 앱 구성 파일 예제에서는 를 제거하고 DefaultTraceListener 를 추가하여 ConsoleTraceListener 추적 원본에 대한 추적 출력을 생성하는 방법을 보여 줍니다. 자세한 내용은 수신기> 및 sharedListeners를 참조<하세요>.<

참고

추적 수신기를 컬렉션에 Listeners 추가하면 추적 수신기에서 사용하는 리소스를 사용할 수 없는 경우 추적하는 동안 예외가 throw될 수 있습니다. throw된 조건 및 예외는 추적 수신기에 따라 달라지며 이 항목에서 열거할 수 없습니다. 추적 수신기의 예외를 검색하고 처리하기 위해 메서드를 TraceSource 블록에 try/catch 호출하는 것이 유용할 수 있습니다.

클래스는 SourceSwitch 추적 출력을 동적으로 제어하는 수단을 제공합니다. .NET Framework 앱의 경우 위의 구성 파일 예제에서는 추적 원본에서 추적을 해제하고 추적이 발생하는 수준을 제어하는 방법을 보여 줍니다. 애플리케이션을 다시 컴파일하지 않고도 소스 스위치 값을 수정할 수 있습니다. 구성 파일을 사용하여 스위치를 설정하는 방법에 대한 자세한 내용은 및 방법: Create, 추적 스위치 초기화 및 구성을 참조 Switch 하세요.

참고

애플리케이션을 중지 했다가 다시 시작 애플리케이션에서 실행 되는 동안 구성 파일을 수정 하는 경우 또는 Refresh 새 설정이 적용 되기 전에 메서드를 호출 해야 합니다.

TraceEventType 열거형은 추적 메시지의 이벤트 유형을 정의하는 데 사용됩니다. 추적 필터는 를 TraceEventType 사용하여 추적 수신기가 추적 메시지를 생성해야 하는지 여부를 결정합니다.

추적 수신기는 필요에 따라 추적 필터를 통한 추가 필터링 계층을 가질 수 있습니다. 추적 수신기에 연결된 필터가 있는 경우 수신기는 해당 필터의 ShouldTrace 메서드를 호출하여 추적 정보를 생성할지 여부를 결정합니다.

추적 수신기는 클래스 속성 Indent, IndentSizeAutoFlush 값을 사용하여 추적 출력의 Trace 서식을 지정합니다. .NET Framework 앱에서는 구성 파일 특성을 사용하여 , IndentSizeAutoFlush 속성을 설정할 Indent수 있습니다. 다음 예제에서는 속성을 로 AutoFlushfalse 설정하고 IndentSize 속성을 3으로 설정합니다.

<configuration>  
  <system.diagnostics>  
    <trace autoflush="false" indentsize="3" />  
  </system.diagnostics>  
</configuration>  

생성자

TraceSource(String)

지정된 소스 이름을 사용하여 TraceSource 클래스의 새 인스턴스를 초기화합니다.

TraceSource(String, SourceLevels)

지정된 소스 이름과 추적이 발생할 기본 소스 수준을 사용하여 TraceSource 클래스의 새 인스턴스를 초기화합니다.

속성

Attributes

애플리케이션 구성 파일에 정의된 사용자 지정 스위치 특성을 가져옵니다.

DefaultLevel

생성자에 할당된 기본 수준을 가져옵니다.

Listeners

추적 소스에 대한 추적 수신기의 컬렉션을 가져옵니다.

Name

추적 소스의 이름을 가져옵니다.

Switch

소스 스위치 값을 가져오거나 설정합니다.

메서드

Close()

추적 수신기 컬렉션에 있는 모든 추적 수신기를 닫습니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
Flush()

추적 수신기 컬렉션에 있는 모든 추적 수신기를 플러시합니다.

GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetSupportedAttributes()

추적 소스에서 지원하는 사용자 지정 특성을 가져옵니다.

GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
TraceData(TraceEventType, Int32, Object)

지정된 이벤트 형식, 이벤트 식별자 및 추적 데이터를 사용하여 Listeners 컬렉션의 추적 수신기에 추적 데이터를 씁니다.

TraceData(TraceEventType, Int32, Object[])

지정된 이벤트 형식, 이벤트 식별자 및 추적 데이터 배열을 사용하여 Listeners 컬렉션의 추적 수신기에 추적 데이터를 씁니다.

TraceEvent(TraceEventType, Int32)

지정된 이벤트 형식 및 이벤트 식별자를 사용하여 Listeners 컬렉션의 추적 수신기에 추적 이벤트 메시지를 씁니다.

TraceEvent(TraceEventType, Int32, String)

지정된 이벤트 형식, 이벤트 식별자 및 메시지를 사용하여 Listeners 컬렉션의 추적 수신기에 추적 이벤트 메시지를 씁니다.

TraceEvent(TraceEventType, Int32, String, Object[])

지정된 이벤트 형식, 이벤트 식별자, 인수 배열 및 형식을 사용하여 Listeners 컬렉션의 추적 수신기에 추적 이벤트를 씁니다.

TraceInformation(String)

지정된 메시지를 사용하여 Listeners 컬렉션의 추적 수신기에 알림 메시지를 씁니다.

TraceInformation(String, Object[])

지정된 개체 배열과 형식 지정 정보를 사용하여 Listeners 컬렉션의 추적 수신기에 알림 메시지를 씁니다.

TraceTransfer(Int32, String, Guid)

지정된 숫자 식별자, 메시지 및 관련 작업 식별자를 사용하여 Listeners 컬렉션의 추적 수신기에 추적 전송 메시지를 씁니다.

이벤트

Initializing

TraceSource 초기화해야 할 때 발생합니다.

적용 대상

스레드 보안

이 형식은 스레드로부터 안전합니다.

추가 정보