Įvykiai
03-17 23 - 03-21 23
Prisijunkite prie meetup serijos, kad sukurtumėte keičiamo dydžio DI sprendimus, pagrįstus realaus pasaulio naudojimo atvejais, su kolegomis kūrėjais ir ekspertais.
Registruotis dabarŠi naršyklė nebepalaikoma.
Atnaujinkite į „Microsoft Edge“, kad pasinaudotumėte naujausiomis funkcijomis, saugos naujinimais ir techniniu palaikymu.
The My.Application.Log
object can write information to several log listeners. The log listeners are configured by the computer's configuration file and can be overridden by an application's configuration file. This topic describes the default settings and how to determine the settings for your application.
For more information about the default output locations, see Working with Application Logs.
Locate the assembly's configuration file. If you are developing the assembly, you can access the app.config in Visual Studio from the Solution Explorer. Otherwise, the configuration file name is the assembly's name appended with ".config", and it is located in the same directory as the assembly.
Pastaba
Not every assembly has a configuration file.
The configuration file is an XML file.
Locate the <listeners>
section, in the <source>
section with the name
attribute "DefaultSource", located in the <sources>
section. The <sources>
section is located in the <system.diagnostics>
section, in the top-level <configuration>
section.
If these sections do not exist, then the computer's configuration file may configure the My.Application.Log
log listeners. The following steps describe how to determine what the computer configuration file defines:
Locate the computer's machine.config file. Typically, it is located in the SystemRoot\Microsoft.NET\Framework\frameworkVersion\CONFIG directory, where SystemRoot
is the operating system directory, and frameworkVersion
is the version of the .NET Framework.
The settings in machine.config can be overridden by an application's configuration file.
If the optional elements listed below do not exist, you can create them.
Locate the <listeners>
section, in the <source>
section with the name
attribute "DefaultSource", in the <sources>
section, in the <system.diagnostics>
section, in the top-level <configuration>
section.
If these sections do not exist, then the My.Application.Log
has only the default log listeners.
Locate the <add>
elements in the <listeners>
section.
These elements add the named log listeners to My.Application.Log
source.
Locate the <add>
elements with the names of the log listeners in the <sharedListeners>
section, in the <system.diagnostics>
section, in the top-level <configuration>
section.
For many types of shared listeners, the listener's initialization data includes a description of where the listener directs the data:
A Microsoft.VisualBasic.Logging.FileLogTraceListener listener writes to a file log, as described in the introduction.
A System.Diagnostics.EventLogTraceListener listener writes information to the computer event log specified by the initializeData
parameter. To view an event log, you can use Server Explorer or Windows Event Viewer. For more information, see ETW Events in the .NET Framework.
The System.Diagnostics.DelimitedListTraceListener and System.Diagnostics.XmlWriterTraceListener listeners write to the file specified in the initializeData
parameter.
A System.Diagnostics.ConsoleTraceListener listener writes to the command-line console.
For information about where other types of log listeners write information, consult that type's documentation.
.NET atsiliepimas
.NET yra atvirojo kodo projektas. Pasirinkite saitą, kad pateiktumėte atsiliepimą:
Įvykiai
03-17 23 - 03-21 23
Prisijunkite prie meetup serijos, kad sukurtumėte keičiamo dydžio DI sprendimus, pagrįstus realaus pasaulio naudojimo atvejais, su kolegomis kūrėjais ir ekspertais.
Registruotis dabarMokymas
Modulis
Capture Web Application Logs with App Service Diagnostics Logging - Training
Learn about how to capture trace output from your Azure web apps. View a live log stream and download logs files for offline analysis.
Dokumentacija
Changing Where My.Application.Log Writes Information - Visual Basic
Learn more about: Walkthrough: Changing Where My.Application.Log Writes Information (Visual Basic)
Filtering My.Application.Log Output - Visual Basic
Learn more about: Walkthrough: Filtering My.Application.Log Output (Visual Basic)
Working with Application Logs - Visual Basic
Learn more about: Working with Application Logs in Visual Basic