How to: Write Log Messages (Visual Basic)
You can use the My.Application.Log
and My.Log
objects to log information about your application. This example shows how to use the My.Application.Log.WriteEntry
method to log tracing information.
For logging exception information, use the My.Application.Log.WriteException
method; see How to: Log Exceptions.
Example
This example uses the My.Application.Log.WriteEntry
method to write out the trace information.
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 Security
Make sure the data you write to the log does not include sensitive information such as user passwords. For more information, see Working with Application Logs.
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for