Log Class

 

Provides a property and methods for writing event and exception information to the application's log listeners.

Namespace:   Microsoft.VisualBasic.Logging
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

System.Object
  Microsoft.VisualBasic.Logging.Log
    Microsoft.VisualBasic.Logging.AspLog

[HostProtectionAttribute(SecurityAction.LinkDemand, Resources = HostProtectionResource.ExternalProcessMgmt)]
public class Log

NameDescription
System_CAPS_pubmethodLog()

Initializes a new instance of the Log class.

System_CAPS_pubmethodLog(String)

Initializes a new instance of the Log class.

NameDescription
System_CAPS_pubpropertyDefaultFileLogWriter

Gets the file the FileLogTraceListener object that underlies the Log object.

System_CAPS_pubpropertyTraceSource

Gets to the TraceSource object that underlies the Log object.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodInitializeWithDefaultsSinceNoConfigExists()

Creates a new FileLogTraceListener object and adds it to the Listeners collection.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodWriteEntry(String)

Writes a message to the application's log listeners.

System_CAPS_pubmethodWriteEntry(String, TraceEventType)

Writes a message to the application's log listeners.

System_CAPS_pubmethodWriteEntry(String, TraceEventType, Int32)

Writes a message to the application's log listeners.

System_CAPS_pubmethodWriteException(Exception)

Writes exception information to the application's log listeners.

System_CAPS_pubmethodWriteException(Exception, TraceEventType, String)

Writes exception information to the application's log listeners.

System_CAPS_pubmethodWriteException(Exception, TraceEventType, String, Int32)

Writes exception information to the application's log listeners.

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 (Visual Basic) and Working with Application Logs in Visual Basic.

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 (Visual Basic)

Write exception information to the application's log listeners

How to: Log Exceptions in Visual Basic

Determine where My.Application.Log writes information

Walkthrough: Determining Where My.Application.Log Writes Information (Visual Basic)

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 (Visual Basic).

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

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: