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
Property Value
This property returns the My.Application.Log object for the current application.
Remarks
This property provides easy access to the My.Application.Log object. For more information, see My.Application.Log Object.
Example
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
Requirements
Namespace:Microsoft.VisualBasic.ApplicationServices
Class:ApplicationBase
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
Availability by Project Type
Project type |
Available |
---|---|
Windows Application |
Yes |
Class Library |
Yes |
Console Application |
Yes |
Windows Control Library |
Yes |
Web Control Library |
No |
Windows Service |
Yes |
Web Site |
No |
Permissions
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.