AspLog Classe
Definição
Fornece uma propriedade e métodos para gravar informações de evento e de exceção para os ouvintes de log do aplicativo.Provides a property and methods for writing event and exception information to the application's log listeners.
public ref class AspLog : Microsoft::VisualBasic::Logging::Log
public class AspLog : Microsoft.VisualBasic.Logging.Log
type AspLog = class
inherit Log
Public Class AspLog
Inherits Log
- Herança
Exemplos
Este exemplo mostra como usar o método My.Application.Log.WriteEntry para registrar em log informações de rastreamento.This example shows how to use the My.Application.Log.WriteEntry method to log tracing information. Para obter mais informações, consulte como: gravar mensagens de log.For more information, see How to: Write Log Messages.
Public Sub TracingTest(ByVal fileName As String)
My.Application.Log.WriteEntry(
"Entering TracingTest with argument " &
fileName & ".")
' Code to trace goes here.
My.Application.Log.WriteEntry(
"Exiting TracingTest with argument " &
fileName & ".")
End Sub
Comentários
O My.Application.Log objeto fornece um ponto de entrada direto do qual acessar os serviços de log do .NET Framework.The My.Application.Log object provides a straightforward entry point from which to access the .NET Framework's logging services. Os WriteEntry WriteException métodos e gravam mensagens para os ouvintes de log do aplicativo.The WriteEntry and WriteException methods write messages to the application's log listeners. Os ouvintes podem ser configurados pelo arquivo de configuração do aplicativo.The listeners can be configured by the application's configuration file. Para obter mais informações, consulte Walkthrough: Alterando onde meu. Application. log grava informações e trabalhando com logs de aplicativo.For more information, see Walkthrough: Changing Where My.Application.Log Writes Information and Working with Application Logs.
O My.Application.Log objeto está disponível somente para aplicativos cliente.The My.Application.Log object is available only for client applications. Para aplicativos Web, use My.Log .For Web applications, use My.Log. Para obter mais informações, consulte Microsoft.VisualBasic.Logging.Log.For more information, see Microsoft.VisualBasic.Logging.Log.
A tabela a seguir lista exemplos de tarefas que envolvem o My.Application.Log objeto.The following table lists examples of tasks involving the My.Application.Log object.
| ParaTo | ConsulteSee |
|---|---|
| Gravar informações de evento nos ouvintes de log do aplicativoWrite event information to the application's log listeners | Como: gravar mensagens de logHow to: Write Log Messages |
| Gravar informações de exceção para ouvintes de log do aplicativoWrite exception information to the application's log listeners | Como: registrar exceções em logHow to: Log Exceptions |
Determinar onde My.Application.Log as informações de gravaçãoDetermine where My.Application.Log writes information |
Passo a passo: determinar o local no qual My.Application.Log grava informaçõesWalkthrough: Determining Where My.Application.Log Writes Information |
Construtores
| AspLog() |
Inicializa uma nova instância da classe AspLog.Initializes a new instance of the AspLog class. |
| AspLog(String) |
Inicializa uma nova instância da classe AspLog.Initializes a new instance of the AspLog class. |
Propriedades
| DefaultFileLogWriter |
Obtém o arquivo do objeto FileLogTraceListener que dá suporte ao objeto |
| TraceSource |
Obtém para o objeto TraceSource que dá suporte ao objeto |
Métodos
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object. (Herdado de Object) |
| GetHashCode() |
Serve como a função de hash padrão.Serves as the default hash function. (Herdado de Object) |
| GetType() |
Obtém o Type da instância atual.Gets the Type of the current instance. (Herdado de Object) |
| InitializeWithDefaultsSinceNoConfigExists() |
Cria um novo FileLogTraceListener e adiciona à coleção Listeners.Creates a new FileLogTraceListener and adds it to the Listeners collection. |
| MemberwiseClone() |
Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object. (Herdado de Object) |
| ToString() |
Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object. (Herdado de Object) |
| WriteEntry(String) |
Grava uma mensagem nos ouvintes de log do aplicativo.Writes a message to the application's log listeners. (Herdado de Log) |
| WriteEntry(String, TraceEventType) |
Grava uma mensagem nos ouvintes de log do aplicativo.Writes a message to the application's log listeners. (Herdado de Log) |
| WriteEntry(String, TraceEventType, Int32) |
Grava uma mensagem nos ouvintes de log do aplicativo.Writes a message to the application's log listeners. (Herdado de Log) |
| WriteException(Exception) |
Grava informações de exceção nos ouvintes de log do aplicativo.Writes exception information to the application's log listeners. (Herdado de Log) |
| WriteException(Exception, TraceEventType, String) |
Grava informações de exceção nos ouvintes de log do aplicativo.Writes exception information to the application's log listeners. (Herdado de Log) |
| WriteException(Exception, TraceEventType, String, Int32) |
Grava informações de exceção nos ouvintes de log do aplicativo.Writes exception information to the application's log listeners. (Herdado de Log) |