Log Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides a property and methods for writing event and exception information to the application's log listeners.
public ref class Log
public class Log
type Log = class
Public Class Log
- Inheritance
-
Log
- Derived
This example shows how to use the My.Application.Log.WriteEntry
method to log tracing information. 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
The My.Application.Log
object provides a straightforward entry point from which to access the .NET Framework's logging services. The WriteEntry
and WriteException
methods write messages to the application's log listeners. The listeners can be configured by the application's configuration file. For more information, see Walkthrough: Changing Where My.Application.Log Writes Information and Working with Application Logs.
The My.Application.Log
object is available only for client applications. For Web applications, use My.Log
. For more information, see AspLog.
The following table lists examples of tasks involving the My.Application.Log
object.
To | See |
---|---|
Write event information to the application's log listeners | How to: Write Log Messages |
Write exception information to the application's log listeners | How to: Log Exceptions |
Determine where My.Application.Log writes information |
Walkthrough: Determining Where My.Application.Log Writes Information |
Log() |
Initializes a new instance of the Log class. |
Log(String) |
Initializes a new instance of the Log class. |
Default |
Gets the file the FileLogTraceListener object that underlies the |
Trace |
Gets to the TraceSource object that underlies the |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
Get |
Serves as the default hash function. (Inherited from Object) |
Get |
Gets the Type of the current instance. (Inherited from Object) |
Initialize |
Creates a new FileLogTraceListener object and adds it to the Listeners collection. |
Memberwise |
Creates a shallow copy of the current Object. (Inherited from Object) |
To |
Returns a string that represents the current object. (Inherited from Object) |
Write |
Writes a message to the application's log listeners. |
Write |
Writes a message to the application's log listeners. |
Write |
Writes a message to the application's log listeners. |
Write |
Writes exception information to the application's log listeners. |
Write |
Writes exception information to the application's log listeners. |
Write |
Writes exception information to the application's log listeners. |
Proizvod | Verzije |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 5, 6, 7, 8, 9, 10 |
.NET povratne informacije
.NET je projekat otvorenog koda. Odaberite vezu za pružanje povratnih informacija: