This documentation is archived and is not being maintained.

My.Application.Log Property 

Gets an object that provides properties and methods for writing event and exception information to the application's log listeners.

' Usage
Dim value As Microsoft.VisualBasic.Logging.Log = My.Application.Log
' Declaration
Public ReadOnly Property Log As MyLog

This property returns the My.Application.Log object for the current application.

This property provides easy access to the My.Application.Log object. For more information, see My.Application.Log Object.

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

Namespace: Microsoft.VisualBasic.ApplicationServices

Class: ApplicationBase

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

Availability by Project Type

Project type Available

Windows Application


Class Library


Console Application


Windows Control Library


Web Control Library


Windows Service


Web Site


The following permission may be necessary:

Permission Description


Controls the ability to access files and folders. Associated enumeration: Unrestricted.

For more information, see Code Access Security and Requesting Permissions.