TraceSource Clase
Definición
Proporciona un conjunto de métodos y propiedades que permiten que las aplicaciones realicen un seguimiento de la ejecución de código y asocien mensajes de seguimiento con su origen.Provides a set of methods and properties that enable applications to trace the execution of code and associate trace messages with their source.
public ref class TraceSource
public class TraceSource
type TraceSource = class
Public Class TraceSource
- Herencia
-
TraceSource
Ejemplos
En el ejemplo de código siguiente se muestra el uso de la TraceSource clase para reenviar seguimientos a agentes de escucha.The following code example shows the use of the TraceSource class to forward traces to listeners. En el ejemplo también se muestra el uso del modificador y el filtro.The example also demonstrates switch and filter usage.
/////////////////////////////////////////////////////////////////////////////////
//
// 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
Comentarios
Las aplicaciones utilizan la clase TraceSource para generar seguimientos que pueden asociarse con la aplicación.The TraceSource class is used by applications to produce traces that can be associated with the application. TraceSource proporciona métodos de traza que permiten rastrear fácilmente eventos y datos, así como emitir seguimientos de información.TraceSource provides tracing methods that allow you to easily trace events, trace data, and issue informational traces. La salida del seguimiento de TraceSource se puede controlar mediante la configuración del archivo de configuración.Trace output from TraceSource can be controlled by configuration file settings. El archivo de configuración se encuentra en la carpeta con el archivo ejecutable de la aplicación y tiene el nombre de la aplicación con la extensión de nombre de archivo. config agregada.The configuration file is located in the folder with the application executable and has the name of the application with the .config file name extension added. Por ejemplo, el nombre del archivo de configuración para TraceSourceSample.exe es TraceSourceSample.exe.config. El archivo de configuración se puede usar para determinar dónde se va a enviar la información de seguimiento y los niveles de actividad de los que se va a realizar un seguimiento.For example, the name of the configuration file for TraceSourceSample.exe is TraceSourceSample.exe.config. The configuration file can be used to determine where the trace information is to be sent and what levels of activity are to be traced. En el ejemplo siguiente se muestra el contenido de un archivo de configuración de la aplicación de ejemplo.The following example shows the contents of a sample application configuration file.
<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>
La TraceSource clase se identifica mediante el nombre de un origen, normalmente el nombre de la aplicación.The TraceSource class is identified by the name of a source, typically the name of the application. Los mensajes de seguimiento procedentes de un componente determinado pueden ser iniciados por un origen de seguimiento determinado, lo que permite identificar fácilmente todos los mensajes procedentes de ese componente.The trace messages coming from a particular component can be initiated by a particular trace source, allowing all messages coming from that component to be easily identified.
TraceSource define métodos de seguimiento, pero no proporciona realmente ningún mecanismo específico para generar y almacenar datos de seguimiento.TraceSource defines tracing methods but does not actually provide any specific mechanism for generating and storing tracing data. Los datos de seguimiento se generan mediante agentes de escucha de seguimiento, que son complementos que pueden ser cargados por orígenes de seguimiento.The tracing data is produced by trace listeners, which are plug-ins that can be loaded by trace sources.
Nota
No debe llamar a los métodos de seguimiento durante la finalización.You should not call the tracing methods during finalization. Si lo hace, puede producirse una ObjectDisposedException excepción.Doing so can result in an ObjectDisposedException being thrown.
Puede personalizar el destino del resultado de seguimiento agregando o quitando TraceListener instancias de o de la colección almacenada en la TraceSource.Listeners propiedad.You can customize the tracing output's target by adding or removing TraceListener instances to or from the collection stored in the TraceSource.Listeners property. De forma predeterminada, la salida de seguimiento se genera mediante una instancia de la DefaultTraceListener clase.By default, trace output is produced using an instance of the DefaultTraceListener class. En el ejemplo de archivo de configuración anterior se muestra cómo quitar DefaultTraceListener y agregar ConsoleTraceListener para generar el resultado del seguimiento para el origen de seguimiento.The preceding configuration file example demonstrates removing the DefaultTraceListener and adding a ConsoleTraceListener to produce the trace output for the trace source. Para obtener más información, vea < agentes > de escucha y < sharedListeners > .For more information, see <listeners> and <sharedListeners>.
Nota
Agregar un agente de escucha de seguimiento a la Listeners colección puede hacer que se produzca una excepción durante el seguimiento, si un recurso utilizado por el agente de escucha de seguimiento no está disponible.Adding a trace listener to the Listeners collection can cause an exception to be thrown while tracing, if a resource used by the trace listener is not available. Las condiciones y la excepción que se producen dependen del agente de escucha de seguimiento y no se pueden enumerar en este tema.The conditions and the exception thrown depend on the trace listener and cannot be enumerated in this topic. Puede ser útil realizar llamadas a los TraceSource métodos de los try / catch bloques para detectar y controlar las excepciones de los agentes de escucha de seguimiento.It may be useful to place calls to the TraceSource methods in try/catch blocks to detect and handle any exceptions from trace listeners.
La SourceSwitch clase proporciona los medios para controlar dinámicamente los resultados del seguimiento.The SourceSwitch class provides the means to dynamically control the tracing output. En el ejemplo de archivo de configuración anterior se muestra cómo deshabilitar el seguimiento de un origen de seguimiento y controlar el nivel en el que se produce el seguimiento.The preceding configuration file example shows how you can turn off tracing from a trace source and control the level at which tracing occurs. Puede modificar el valor del modificador de origen sin volver a compilar la aplicación.You can modify the value of the source switch without recompiling your application. Para obtener información sobre el uso del archivo de configuración para establecer un modificador, vea Switch y Cómo: crear, inicializar y configurar modificadores de seguimiento.For information on using the configuration file to set a switch, see Switch and How to: Create, Initialize and Configure Trace Switches.
Nota
Si modifica un archivo de configuración mientras se está ejecutando una aplicación, se debe detener y reiniciar la aplicación, o bien Refresh se debe llamar al método antes de que la nueva configuración surta efecto.If you modify a configuration file while an application is executing, the application must be stopped and restarted or the Refresh method must be called before the new settings take effect.
La TraceEventType enumeración se utiliza para definir el tipo de evento del mensaje de seguimiento.The TraceEventType enumeration is used to define the event type of the trace message. Los filtros de seguimiento usan TraceEventType para determinar si un agente de escucha de seguimiento debe generar el mensaje de seguimiento.Trace filters use the TraceEventType to determine if a trace listener should produce the trace message.
Los agentes de escucha de seguimiento pueden tener opcionalmente un nivel adicional de filtrado a través de un filtro de seguimiento.The trace listeners can optionally have an additional layer of filtering through a trace filter. Si un agente de escucha de seguimiento tiene un filtro asociado, el agente de escucha llama al ShouldTrace método en ese filtro para determinar si se debe generar o no la información de seguimiento.If a trace listener has an associated filter, the listener calls the ShouldTrace method on that filter to determine whether or not to produce the trace information.
Los agentes de escucha de seguimiento usan los valores de las Trace propiedades de clase Indent , IndentSize y AutoFlush para dar formato a los resultados de seguimiento.The trace listeners use the values of the Trace class properties Indent, IndentSize, and AutoFlush to format trace output. Puede usar los atributos del archivo de configuración para establecer las Indent IndentSize propiedades, y AutoFlush .You can use configuration file attributes to set the Indent, IndentSize, and AutoFlush properties. En el ejemplo siguiente se establece la AutoFlush propiedad en false y la IndentSize propiedad en 3.The following example sets the AutoFlush property to false and the IndentSize property to 3.
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="3" />
</system.diagnostics>
</configuration>
Constructores
| TraceSource(String) |
Inicializa una instancia nueva de la clase TraceSource usando el nombre especificado para el origen.Initializes a new instance of the TraceSource class, using the specified name for the source. |
| TraceSource(String, SourceLevels) |
Inicializa una nueva instancia de la clase TraceSource con el nombre especificado para el origen y el nivel de origen predeterminado en el que se producirá el seguimiento.Initializes a new instance of the TraceSource class, using the specified name for the source and the default source level at which tracing is to occur. |
Propiedades
| Attributes |
Obtiene los atributos de modificador personalizados definidos en el archivo de configuración de la aplicación.Gets the custom switch attributes defined in the application configuration file. |
| Listeners |
Obtiene la colección de agentes de escucha de seguimiento para el origen de seguimiento.Gets the collection of trace listeners for the trace source. |
| Name |
Obtiene el nombre del origen de seguimiento.Gets the name of the trace source. |
| Switch |
Obtiene o establece el valor del modificador de origen.Gets or sets the source switch value. |
Métodos
| Close() |
Cierra todos los agentes de escucha de seguimiento en la colección de agentes de escucha de seguimiento.Closes all the trace listeners in the trace listener collection. |
| Equals(Object) |
Determina si el objeto especificado es igual que el objeto actual.Determines whether the specified object is equal to the current object. (Heredado de Object) |
| Flush() |
Vacía todos los agentes de escucha de seguimiento en la colección de agentes de escucha de seguimiento.Flushes all the trace listeners in the trace listener collection. |
| GetHashCode() |
Sirve como la función hash predeterminada.Serves as the default hash function. (Heredado de Object) |
| GetSupportedAttributes() |
Obtiene los atributos personalizados admitidos por el origen de seguimiento.Gets the custom attributes supported by the trace source. |
| GetType() |
Obtiene el Type de la instancia actual.Gets the Type of the current instance. (Heredado de Object) |
| MemberwiseClone() |
Crea una copia superficial del Object actual.Creates a shallow copy of the current Object. (Heredado de Object) |
| ToString() |
Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object. (Heredado de Object) |
| TraceData(TraceEventType, Int32, Object) |
Escribe datos de seguimiento en los agentes de escucha de seguimiento de la colección Listeners con el tipo de evento, el identificador de evento y los datos de seguimiento especificados.Writes trace data to the trace listeners in the Listeners collection using the specified event type, event identifier, and trace data. |
| TraceData(TraceEventType, Int32, Object[]) |
Escribe datos de seguimiento en los agentes de escucha de seguimiento de la colección Listeners con el tipo de evento, el identificador de evento y la matriz de datos de seguimiento especificados.Writes trace data to the trace listeners in the Listeners collection using the specified event type, event identifier, and trace data array. |
| TraceEvent(TraceEventType, Int32) |
Escribe un mensaje de evento de seguimiento en los agentes de escucha de seguimiento de la colección Listeners con el tipo de evento y el identificador de evento especificados.Writes a trace event message to the trace listeners in the Listeners collection using the specified event type and event identifier. |
| TraceEvent(TraceEventType, Int32, String) |
Escribe un mensaje de evento de seguimiento en los agentes de escucha de seguimiento de la colección Listeners con el tipo de evento, el identificador de evento y el mensaje especificados.Writes a trace event message to the trace listeners in the Listeners collection using the specified event type, event identifier, and message. |
| TraceEvent(TraceEventType, Int32, String, Object[]) |
Escribe un evento de seguimiento en los agentes de escucha de seguimiento de la colección Listeners con el tipo de evento, el identificador de evento y el formato y la matriz de argumentos especificados.Writes a trace event to the trace listeners in the Listeners collection using the specified event type, event identifier, and argument array and format. |
| TraceInformation(String) |
Escribe un mensaje informativo en los agentes de escucha de seguimiento de la colección Listeners con el mensaje especificado.Writes an informational message to the trace listeners in the Listeners collection using the specified message. |
| TraceInformation(String, Object[]) |
Escribe un mensaje informativo en los agentes de escucha de seguimiento de la colección Listeners con la matriz de objetos y la información de formato especificadas.Writes an informational message to the trace listeners in the Listeners collection using the specified object array and formatting information. |
| TraceTransfer(Int32, String, Guid) |
Escribe un mensaje de transferencia de seguimiento en los agentes de escucha de seguimiento de la colección Listeners con el identificador numérico, el mensaje y el identificador de actividad relacionado especificados.Writes a trace transfer message to the trace listeners in the Listeners collection using the specified numeric identifier, message, and related activity identifier. |
Se aplica a
Seguridad para subprocesos
Este tipo es seguro para la ejecución de subprocesos.This type is thread safe.